schtasks.exe via vbscript .Run parm

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
w216uhk
Posts: 34
Last visit: Wed Jul 16, 2014 7:33 am

schtasks.exe via vbscript .Run parm

Post by w216uhk »

I'm looking to run this command in a script if certain conditions are met all that is fine however, due to the Windows 7 secuirty options, I get access denied. However if you manually launch CMD as administraor by right clicking and typing the command line the tasks creates.oWSH.Run cmd /k schtasks /Create /XML c:path to XML file /tn:at1So my questions is does anybody know a scirpted solution around this I have my task stored in an XML and yes it needs to be created as the User and only run if the user is logged in (the XML contains all the control data). When running the task it uses the Builtin Users.Any idea how to make vbscript do the same as run. Using WMI does it as system by default unless there is some way around this I'am missing.Thank you for any insight
User avatar
w216uhk
Posts: 34
Last visit: Wed Jul 16, 2014 7:33 am

schtasks.exe via vbscript .Run parm

Post by w216uhk »

Resolved C# code to to elevate rights of schtasks.exe.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

schtasks.exe via vbscript .Run parm

Post by jvierra »

Thisis a scripting forum. If you have C# questions you will need to ask them in a Developers forum.

Yes - we know that you can create trusted assemblies that will get you where you need to go. It is kind of overkill scince you can run schtasks remotely without elevation and not have an issue. In POwerShell V3 this wil actually be even easier however elevation will always be required when altering the local machine.


Occam's Razor. Use it.jvierra2012-03-31 10:01:10
This topic is 11 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked