Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: creating a batch script to create a scedualed task on multiple pc's

19 Dec 2015   #1
joeykong

windows 10 64bit
 
 
creating a batch script to create a scedualed task on multiple pc's

so im an IT specialist at a big car dealer ship im not that good with scripting but what i want to do is when i go around to a computer i want to be able to put a flash drive in run a batch script that creates a folder on the C drive transfers a few files (xml and .bat ) to that folder then from that folder i want to run the batch script that will create a scheduled task to run ccleaner when the pc is in idle for 10 min
we have 600+ pc's some are on the domain some are off the domain with various user names/passwords and pc names also different os's (xp win 7 and some vista) some are 32 bit but most are 64 bit


ok so i made a scheduled task on my pc then exported the XML i put the files on a flash drive then i made a batch to copy the other batch scripts/xml's to a folder on the c drive (that part im having no issue with )only issue i have is when i try to run the batch to make the task on a different pc then the one i created it on i get a message saying "error: no mapping between account names and security ID's was done <17,8>:logon type
i plan on just popping in the flash drive and running these scripts as i go around doing the preventive maintenance or wile im on a pc to troubleshoot an issue


here are my scripts

this one is run off the flash drive and creates a folder on the c drive i have no issues with that but im posting it just as a reference

@echo off
REM Check if 32 or 64-bit OS
if "%Processor_Architecture%"=="" goto oscheck
if "%Processor_Architecture%"=="x86" goto x86
if "%Processor_Architecture%"=="AMD64" goto x64

:x64
mkdir c:\autocleaner
copy createtask64bit.bat c:\autocleaner\
copy createtask32bit.bat c:\autocleaner\
copy autoclean32bit.xml c:\autocleaner\
copy ccleaner64.xml c:\autocleaner\
echo Everything was copied to \autocleaner to be installed
eject
pause
exit



after that i go to the autocleaner folder on the c drive and then run the other script either the 32 bit or 64 bit depending on the pc
both scripts are the same only diffence is what xml file it points to


schtasks /create /tn "ccleaner64" /xml "c:\autocleaner\ccleaner64.xml"
PAUSE

any suggestions ? id also like to be able to do this from one of our network drives

i can also attach the scrips and xml files if needed

thank you


My System SpecsSystem Spec
.
20 Dec 2015   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi there,

Quote   Quote: Originally Posted by joeykong View Post
only issue i have is when i try to run the batch to make the task on a different pc then the one i created it on i get a message saying "error: no mapping between account names and security ID's was done <17,8>:logon type
Is this the only issue?

It's not a problem with batch but with Task Scheduler. Before you can import a task that originated from another computer, data contained in the "UserId" element of the task xml has to be changed to match up with a user that exists on the machine you are importing the task to.

E.g.
Code:
  <Principals>
    <Principal id="Author">
      <UserId>COMPUTERNAME\Username</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
The part in red must be changed to one of the users of the machine you are trying to importing this task to.
My System SpecsSystem Spec
21 Dec 2015   #3
joeykong

windows 10 64bit
 
 

thank you but i found out on a different forum to change it to system then run as admin this worked perfect for me on 2 pc's iv tested it on so far
thank you very much for your reply tho
Principal id="Author">
<UserId>System</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
My System SpecsSystem Spec
.

Reply

 creating a batch script to create a scedualed task on multiple pc's




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
batch&task to create new folder and move all desktop file to it
hi so work in an recruitment office and im trying to create a batch file that the computers can run on a schedule to create a folder with that days date on it and move all files from the desktop to that folder( also created on the desktop), i want the code to only move files and leave folders and...
General Discussion
Windows 7 creating blank txt file after running a batch script
I have the following batch script @echo off setlocal enableextensions set "baseName=dnshistory" set "count=0" for /f "delims=%baseName%." %%a in (
General Discussion
Creating a batch script or use a 3rdpartyprogram to create shortcuts
Hello! I'm having trouble creating a batch script to simply copy a shortcut to the desktop from a program installation, then carry out some tasks. Overall my goals are: Burn a CD that includes a autorun.inf that will load a batch script In the script I want it to activate two self...
General Discussion
Need help creating a task scheduler task to move files over a network.
Hello everyone, I need to have a task run that will move the contents of a folder from one computer to another over my home LAN. Files get downloaded during the night on one computer and then need to be transfered to another. Usually I am doing this by hand, but then though maybe I could get...
General Discussion
Is there a Script or batch file that can create folders by date range
I was wondering if there was a way to create a set of folders in a specific directory according to a date range that i input. ie. Select start date 2011 10 01 select end date 2012 10 01 Select Output path of c:\users\XXXX\desktop\export data
General Discussion
Help me with Batch script!
Hi, Can somebody assist me with a .bat file I am trying to create? This is what I have now: start /d "C:\Users\Me\Desktop\ghost" ghost.exe start /d "C:\Users\Me\Desktop" Poweroff.exe C:\Windows\System32\powercfg.exe /setactive e428f8a5-615e-488f-b7f7-1ed39450e522The first 2 lines start...
Software


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:58.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App