#91613 - 2003-02-27 04:39 PM
wmi wont run as SYSTEM?
|
rollo
Getting the hang of it
Registered: 2000-07-11
Posts: 85
Loc: louisiana
|
hello, I use the following code in our logon to gather info. works GREAT! I also use norton system center to push out jobs with same code, when it runs the job, it runs as user "system" But the script bombs out. I am not sure if the impersonate thing is what is problem is. any help would be appreciated. if this is off topic I apologize. thanks Adam code:
BREAK ON
$Manufacturer = WMIQuery("Manufacturer","Win32_ComputerSystem") $SystemModel = WMIQuery("Model","Win32_ComputerSystem") $SystemSerialNumber = WMIQuery("SerialNumber","Win32_BIOS") $CPUManufacturer = WMIQuery("manufacturer","Win32_Processor") $SystemMemory = val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024 FUNCTION WMIQuery($what,$where,) DIM $strquery, $objenumerator, $value $strquery = "Select $what From $where" $systemset = GetObject("winmgmts:{impersonationLevel=impersonate}!//@WKSTA") $objenumerator = $systemset.execquery($strquery) FOR EACH $objinstance IN $objenumerator IF @error = 0 AND $objinstance <> "" $=execute("$$value = $$objInstance.$what") $wmiquery="$value"+"|"+"$WMIQuery" ENDIF NEXT $wmiquery=left($wmiquery,len($wmiquery)-1) EXIT @error ENDFUNCTION
return
|
|
Top
|
|
|
|
#91619 - 2003-03-03 03:31 PM
Re: wmi wont run as SYSTEM?
|
rollo
Getting the hang of it
Registered: 2000-07-11
Posts: 85
Loc: louisiana
|
I got it working with user system I changed the line. from this code:
$systemset = GetObject("winmgmts:{impersonationLevel=impersonate}!//@WKSTA")
to this code:
$systemset = GetObject("winmgmts:\\.")
I also dimmed the vars this all seemed to fix it [ 03. March 2003, 15:34: Message edited by: rollo ]
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 1619 anonymous users online.
|
|
|