Run as administrator

(imported topic written by BuzzBourque)

OS: Windows 7 (x64 and x86)

What is the recommended method for running certain Windows commands that require “run as administrator”? For example, say I wanted to run a command to create a directory under c:\windows\system32 by using the following command…

waithidden cmd /c “MD C:\Windows\System32\testdir”

…the task would complete sucessfully but the directory would not be created.

More examples…

//Prepare drive for Bitlocker

waithidden cmd /c “BdeHdCfg -target c: shrink -newdriveletter s: -size 300 -quiet -restart”

//Rename computer

waithidden cmd /c “WMIC ComputerSystem where Name=”%computername%" call Rename Name=newname"

…I’ve tried different methods of running these commands; creatfile, appendfile, run, wait, dos, etc. with no success.

any help would be appreciated.

(imported comment written by SystemAdmin)

Try removing your quotes around the command

waithidden cmd /c MD “C:\Windows\System32\testdir”

waithidden cmd /c WMIC ComputerSystem where Name="%computername%" call Rename Name=newname

(imported comment written by BuzzBourque)

I discovered that using the code below at the top of my fixlet allows the client to get outside of the 32-bit world created for it by the Windows On Windows64 (Wow64) facility built into the new 64-bit versions of the Windows operating system

action uses wow64 redirection {not x64 of operating system}

Thanks for the help.