Run command with admin right

Hi,

I can not run this command (from action script) without admin right:

dos schtasks /create /XML “C:\APBS\Install\APBS_Sys_Cntlr_V1.6.8B1\config.xml” /tn “APBS-SC Installation” /F

Thanks,
Vo

We would almost certainly need more information, like what’s int he XML, what do you expect to happen, what’s actually happening, does that work on a normal command line,e tc.

It only works in admin command prompt. Without admin right, it got rejected.

When executed in ActionScript, it is running in the LocalSystem account with elevated privileges.
However by default it would also be running the 32-bit version of schtasks. Try adding

action uses wow64 redirection false

anywhere before the ‘dos’ command. If that doesn’t do it, let’s try replacing the ‘dos’ command entirely (that is an extremely old way of launching command prompts, I haven’t used it much myself and couldn’t speak to any limitations it may have). Instead use the ‘wait’ command to launch cmd.exe directly:

action uses wow64 redirection false
wait cmd.exe /c "schtasks /create /XML "C:\APBS\Install\APBS_Sys_Cntlr_V1.6.8B1\config.xml" /tn "APBS-SC Installation" /F"
1 Like

I use this command often without issues, but i use run instead of Dos.
What is the error, or how do you know it is not working?

run schtasks /Create /XML "C:\installers\SelfHeal\SelfHeal" /TN "SelfHeal"

1 Like

I tried your script but I still not see the new task in Task Scheduler. It means it didn’t work.

Thanks.

I tried your command and it didn’t work.

I paste this command to admin command prompt and it works. I still can not make it work in bigfix.

Are you trying this from the Fixlet Debugger, or have tried deploying this as an action on target machine?

Try manually running in a psexec environment. Read through the tips at Tip: Troubleshooting ActionScript Command Lines (Windows) and try #3. Let us know what error messages or pop-up windows get displayed.

I tried on the action on target machine.

I got Access is denied.

From that System command prompt, try displaying the file.

dir "C:\APBS\Install\APBS_Sys_Cntlr_V1.6.8B1\config.xml"

type "C:\APBS\Install\APBS_Sys_Cntlr_V1.6.8B1\config.xml"

Perhaps your directory permissions do not allow the LocalSystem account to access the file.

dir or type is ok.

Ok so the basic filesystem permissions seem to be ok.
You’ll need to be able to create the schedule task in that context (using psexec) before you can hope to make it deployable through BigFix.

I don’t know if this is some limitation on the Task Scheduler itself, or whether your environment has some customized permissions that are blocking it.

One thing I’d speculate, is perhaps your task is configured to run under a specific user account, and you might not be able to import that XML under another user account like LocalSystem.

See whether you can import that XML using any other user acccount.

See whether you can create a new task as the LocalSystem account via psexec.

That should point to whether it’s a problem using LocalSystem completely, or whether you perhaps need to change the task you exported to XML so the task itself is configured to run as LocalSystem instead of under your admin account.

Another thing to think about, what if the task already exists? May get an error if it is.

Thanks for your clarification.

I fixed it. The problem is in the config.xml. The userid is incorrect. I need to add the system user to make it works.

1 Like

I have no idea but I fixed it.