running vbscript with admin privilege

March 29, 2011 at 03:04:58
Specs: Windows 7
What are the lines that we need to add into any vb-script, which will run with the access right of administrator of a domain.

See More: running vbscript with admin privilege

Report •

#1
March 29, 2011 at 04:44:54
for quick response i am also adding the vb-script which i am using right now.
--------------------------------------------------------------
On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetCards = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objNetCard in colNetCards
arrDNSServers = Array("10.5.18.15", "10.5.18.14")
objNetCard.SetDNSServerSearchOrder(arrDNSServers)
Next
-------------------------------------------------------------------------
this script runs only under administrative privilege.
But i need to run it under domain user privilege.

Please help.
though i need to deploy it on around 4000 w/s.


Report •
Related Solutions


Ask Question