Running a VBScript file with Scripting as SYSTEM is not executing
New to KACE and have a major deployment we need to have done by the end of the month (July, 2013).
Can't get the following script to run at all.
Major Information: Running the script as Online KScript
Status is Production
Enabled is checked
One test machine is seleted
All Microsoft Windows OS's are seleted.
Being run as a Local System
Has an alert before run - set for 3 minutes; dialog timeout action is OK; Snooze Duration is 3 min.
Only Don't Run on a Schedule is seleted
Dependencies include the script file to be run and another which will be scheduled to run as the logged on user at a later date.
Task 1 is attached as an image.
VBScript to create the task is below. I'm running the script by forcing an update. The Scripting Log is empty.
Set WSHNetwork = CreateObject("WScript.Network")
set objFSO = CreateObject("Scripting.FileSystemObject")
Set WShShell = CreateObject("WScript.Shell")
SystemDrive = WShShell.ExpandEnvironmentStrings("%SystemDrive%")
SystemRoot = WShShell.ExpandEnvironmentStrings("%SystemRoot%") ' usu. C:\Windows
System32 = SystemRoot & "\System32" msgTitle = "WesTech Engineering, Inc. "
msgDelay = 2 If not objFSO.FolderExists(SystemDrive & "\Temp") then objFSO.CreateFolder SystemDrive & "\Temp\"
set logFile = objFSO.OpenTextFile (SystemDrive & "\temp\CreateTask_" & WSHNetwork.ComputerName & "_" & WSHNetwork.username & ".txt",2, true )
logFile.writeline FormatDateTime(now,2) & " " & FormatDateTime(now,3) & " - Autodesk 2014 Update Started " & " Computer: " & WSHNetwork.ComputerName & " User: " & WSHNetwork.username Path = System32 & "\schtasks.exe /create /tn " & chr(34) & "UpdateAutodesk" & chr(34) & " /tr C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\281\UpdateAutodesk2014.vbs /sc once /st 05:00 /sd 08/03/2013"
logFile.writeline Path
Return = WShShell.Run(Path,1,TRUE) logfile.close
set objFSO = nothing
set WShShell = nothing
wscript.quit
Answers (1)
I would do this to at least see if it runs, make sure all your scripts and stuff are in a zip file and uploaded to dependenices:
verify that a file exists
c:\windows\system32\msiexec.exe
On success:
1. Unzip a file
Directory: $(KACE_DEPENDENCY_DIR)
File: yourzip.zip
Target: $(KACE_DEPENDENCY_DIR)
2. Launch a program
Directory: $(KACE_DEPENDENCY_DIR)
File: wscript.exe
Parameters: yourscript.vbs
Checkmark next to Wait for completetion.
Comments:
-
To Areiner - yes it is working now. For Dugullett - Let me see if I understand this correctly. I will have a Verify section that checks for the registry value (I prefer that to a text file)existence. Then I will have a Remediation section that runs the scipt identically to the way I did it before in the Verify section. - lkitsmiller 11 years ago
-
Yes. This way the script is not continually running on the same machines. Verify "a registry key exists". Then remediation the same steps you currently have. The next time the schedule is ran it will check the machine, and look for the registry key. If it does not exist it runs the remediation. - dugullett 11 years ago
-
I should also add a section for On Remediation Success to create the registry entry so the verify works correctly after the first run. Thanks for your help. - lkitsmiller 11 years ago
With the verify set to look for the .txt file. Change the remediation to run your script. - dugullett 11 years ago