How to run a TS step as Local administrator
I need to run a Tasq Sequence step as the local administrator to run a script that (among other things) do run gpupdate and installs an app that is hardcoded to only install if it is the local administrator who launches the installation. the app will check for administrator account so beeing a member of administrators does not work. Replacing the app is not an option so I realy need to run as the local administrator. How can this be done with SCCM? I tried http://adventuresinosd.blogspot.com/2008/12/runas-in-sccm-2007-r2.html but it does not work. It fails complainig about access denied. I have verified that the local administrator account is working (i simply used it to log on with) so it's not the account that is the problem. The install script works from MDT (since mdt runs as administrator) SCCM version is 2007R2 and SP2 is installed. Client OS is Win7 32 bit.
April 7th, 2010 7:19pm

What does your command-line look like for this task? It must be trying to contact or use a resource that the "run as" credentials do not have privileges to.Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2010 9:51pm

Have you tried specifying account for a "Run Command Line" task by enabling "Run this step as the following account" option? As it requires domain prefix, use: .\administrator Note that it works only when TS is no longer in Windows PE. Read more about it here: http://technet.microsoft.com/en-us/library/cc431425.aspx
April 7th, 2010 9:52pm

The commandline looks like this cscript.exe "%deployroot%\scripts\"scriptname".wsf SCCM will launch the script if I don't specify an account. The script will then fail since it's not running as admin. In the article I referenced to you create a new variable and sets that to %OSDComputername%\Administrator. You then use "Run this step as the following account" option and enters the new variable as the user. Naturally I also provided the correct password. I will try with .\Administrator right now
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2010 10:03am

it get's even more intersting. I still cant get it to run a script but it will launch notepad.exe as administrator I will try to convert the script into an exe file tomorrow and se what happends
April 8th, 2010 9:59pm

What happens if you run it from command shell: cmd.exe /C cscript.exe scriptname.wsf
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2010 11:55pm

If you mean then i Log on to the box as administrator it works. If do it as system it will start the script but fail in the script since im not administrator I have not tried Cmd /C cscript.exe scriptname.wsf as the run command in SCCM. I will try that monday. Today i tried with a simple hello.exe. I made a vb6 app that just contains a msgbox "hello world". It failed then i try to launch it as admin. Im starting to consider dissabling UAC to see if that helps
April 10th, 2010 12:54am

To my knowledge, %deployroot% is a stand-alone MDT variable and is not valid in ConfigMgr OSD. But if I am wrong on that, have you verified that the local admin account has permissions to %deployroot%\scripts\? Once you switch contexts using the run as, it will try to connect to the share, %deployroot%\scripts\ in this case, with the credentials of the local admin account. Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
Free Windows Admin Tool Kit Click here and download it now
April 10th, 2010 5:37am

IT's an integrates TS so yes it works perfectly if i launch it with system account (I e if i dont specify an account for the TS step). Administrators has full controll on the folder. But just as a test I made a step in PE that copies the script to C:\windows\system32. Once again it works if i launch it as system (however the script will fail since it's not administrator) If i launch it as administrator it fails to run
April 10th, 2010 2:39pm

OK, so what's in the script?Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
Free Windows Admin Tool Kit Click here and download it now
April 10th, 2010 6:27pm

I actually made two testscripts (a lot easier to repro with theese) Test2.vbs Option Explicit Dim oFso Dim oShell Dim oOutFile Set oShell = WScript.CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") Set oOutFile=oFSO.opentextfile(oFSO.GetSpecialFolder(2) & "\test2.log",8,true) oOutFile.writeline("hello") oShell.run "gpupdate /force /target:computer",1,True 'oShell.run ".\install.exe",1,true oShell.run "notepad.exe",1,true MsgBox "hello" If I launch it as system it runs fine, if I launch it as Administrator it gives the very interesting error "Cscript error: Can't find script engine Vbscript for script c:\windows\system32\test2.vbs" And the same as WSF <job id="ZTI-FK-XPChangeCDdrive"> <script language="VBScript" src="ZTIUtility.vbs"/> <script language="VBScript"> Option Explicit Dim oFso Dim oShell Dim oOutFile Set oShell = WScript.CreateObject("WScript.Shell") Set oFSO = CreateObject("Scripting.FileSystemObject") Set oOutFile=oFSO.opentextfile(oFSO.GetSpecialFolder(2) & "\test2.log",8,true) oOutFile.writeline("hello") oShell.run "gpupdate /force /target:computer",1,True 'oShell.run ".\install.exe",1,true oShell.run "notepad.exe",1,true MsgBox "hello" </script> </job> As system it works again, As Administrator it fails "cscript Error: Execution of the Windows Script host failed (access denied)
April 12th, 2010 2:32pm

BUMP Anyone have an asnwer to this? Find this post helpful? Does this post answer your question? Be sure to mark it appropriately to help others find answers to their searches.
Free Windows Admin Tool Kit Click here and download it now
January 5th, 2011 4:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics