K1000 batch file issues
I am trying to run a batch file from the K1000 appliance that will copy some files from a network location down to a PC, execute a command to run the USMT ScanState tool and upload the user state to a network location and then delete the folder with the files initially downloaded.
The script works fine when I run it manually but fails to execute when I push it from the K1000 and don't know why. I run it using my credentials.
Here is the script I am using:
XCOPY /i /e \\ITS-USMT01\USMT\%PROCESSOR_ARCHITECTURE% %systemdrive%\USMT
ECHO Creating migration store.......
start /b /wait \\its-usmt01\usmt\%PROCESSOR_ARCHITECTURE%\scanstate.exe \\ITS-USMT01\User_States\%computername% /o /c /i:miguser.xml /i:migapp.xml /i:migprinters.xml /uel:30 /efs:skip /v:13 /l:scan.log
echo Deleting working directory!!!
rd /s /q %systemdrive%\USMT 1>nul 2>nul
The way I did this is by going to scripts, selecting windows 7 as the OS, added my test box as the device to push the script to, selecting Windows run as "Credentials" and selecting my credentials from the list, selected Notify user before run (just so that I know it is running while testing), allow run without a logged-in user, created a task just entering the commands above in the On Success run a batch file. After saving, Kace created the file Kace1823.bat in the dependencies section. After that I just click on run now. I get notified on my test PC that a task is being ran and then it fails. On the status it logs a failed execution with the following entries:
Running with credntials provided: domain  user [Testadmin] Creating process returned non-zero: C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\364\kace1823.bat : (4294967295) Error Code: -1 Status Code: 0
verify - on_verify_success verify - on_verify_failure verify - launch_program Launching program: 'C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\364\kace1823.bat' '' wait='false
Running kbot: runkbot 364 1571399111 KBotScript::LogScriptInfo - Start id=364 name=ScanState version=1571399109 type=policy execute disconnected=false logged_off=true execute events KBotScript::LogScriptInfo - Finish KBotScript::LogScriptInfo - Start id=364 name=ScanState version=1571399109 type=policy execute disconnected=false logged_off=true execute events KBotScript::LogScriptInfo - Finish KBotScriptManager::CleanupDependencies - clean up dependencies in kbot directory C:\ProgramData\Quest\KACE\kbots_cache\\packages\kbots\364\ CleanupDependencies: file kace1823.bat is part of the dependency list, keep the file runkbot ----- launching [path='C:\ProgramData\Quest\KACE\kbots_cache\packages\kbots\364' program='kace1823.bat' parms='' wait='false'] ----
Are these x64 machines the bat is failing on? If yes try changing your batch xcopy line to
C:\Windows\Sysnative\XCOPY /i /e \\ITS-USMT01\USMT\%PROCESSOR_ARCHITECTURE% %systemdrive%\USMT
Other thought to try is be logged on machine as your super user and choose run as logged in user to see if that works.
Let us know, that will help eliminate a couple of possibilities.