Scripting Question

Error running schtasks.exe

I've setup a script to create a task, but I'm getting an error. I have the script setup as an Online KScript. And have the following line in "On Success" Launch “$(KACE_SYS_DIR)\schtasks.exe” with params “/Create /XML ”\\uncname\folder\task.xml“ /tn ”UAC Whitelist\foldername“”

But it errors with.

Running as SYSTEM
ERROR: Access is denied.
Launched Process: schtasks.exe
Invalid number of parameters

Also I'm attempting to copy a shortcut to the user's desktop %username%\desktop, it says "the operation completed successfully" but the file isn't on the desktop.

I've tested this with a batch file that I run manually on the desktop with elevated access and it works.

Comments

I got it to work by converting the .bat to an exe and running this. “$(KACE_DEPENDENCY_DIR)\install.exe”
Now my issue is that the task that is being created is setting the Security Options to System and won't run the task. Anyone know how\what to assign in the .xml to allow the currently logged on user to the security options?

All Answers

The script will run in the system context and won't have access to a network share unless the computer has access to the share itself (this normally is not the case). Upload the xml file as a script dependency and use the dependency directory variable instead.

Share

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