/build/static/layout/Breadcrumb_cap_w.png

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

2 Comments   [ + ] Show comments
  • It may not make a difference, but try removing the quotes around the parameters. Also run it by using the Run Now button. - dugullett 10 years ago
  • It works if I hit Run now - I want it deployed to all computers in the company. I think my error might have been to not schedule it and expect it to magically run. - lkitsmiller 10 years ago
    • so this is working now or still no? You are wanting to run it on a schedule correct? - areiner 10 years ago
    • I would schedule it. Also set the verify task to check and see if it has already run. You can do this by copying down a blank .txt file, or changing a reg key. The next time the script is ran it checks for that .txt file. If it's there it will not run again. That way it's not running nonstop.

      With the verify set to look for the .txt file. Change the remediation to run your script. - dugullett 10 years ago

Answers (1)

Posted by: areiner 10 years ago
4th Degree Black Belt
2

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 10 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 10 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 10 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ