Click to See Complete Forum and Search --> : script to run a program as administrator


mikeemike
10-29-2002, 07:07 PM
Hello,

Please! could someone help me or show me how to write a script that runs a program as the administrator of a domain in windows2000. I know how to use the runas feature in win2k2 but dont know how to write a script to run a program o service as admin.


thanks in advance

10-30-2002, 05:41 PM
TRY THIS BUDDY GOODLUCK

'The following envokes notepad on the remote machine test01
'You must have administrator privilege on this machine to perform this action.


On Error Resume Next

Set process = GetObject("winmgmts:{impersonationLevel=impersonat e}!\test01
ootcimv2:Win32_process")

result = process.Create ("notepad.exe",null,null,processid)
'WScript.Echo "Method returned result = " & result
'WScript.Echo "Id of new process is " & processid

If Err <>0 then
WScript.Echo Err.Description, "0x" & Hex(Err.Number)
End If

LVH.


------------
mikeemike at 10/29/2002 8:07:14 PM


Hello,

Please! could someone help me or show me how to write a script that runs a program as the administrator of a domain in windows2000. I know how to use the runas feature in win2k2 but dont know how to write a script to run a program o service as admin.


thanks in advance