G
Guest
I’ve been having a blast with WMI creating local administration scripts but I'm just not doing well with accessing networked PCs.
All PCs are XP pro sp1 over IP on... NetWare network (yeah, I know...) .
This Vbscript just reads out pagefile size min,max and current usage. So I can find the incorrectly manual configured PCs (a config best left to the OS). Problem : I have tried various approaches, but I'm still getting one error or another related to security on the target system "permission denied" etc. Works fine local when moniker is changed up (removed).
'Pagefileinfo.vbs'
Option explicit
Dim strMsg, strComputer, objWMIService, colItems, objItem
strComputer = inputbox ("Enter a valid PC netbios name", "Remote page file information retrieval")
' Collect page file info '
Set objWMIService = GetObject("Winmgmts:" _
& "{impersonationLevel=impersonate," _
& "authenticationLevel=pkt," _
& "authority=kerberos}!\\" _
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PageFile")
For Each objItem in colItems
strMsg = strMsg _
& "Initial size : mb " & objItem.InitialSize & vbCrLf _
& "Maximum size : mb " & objItem.MaximumSize & vbCrLf _
& "Current size : mb " & objItem.FileSize \ 1048576 & vbCrLf _
& "___________________" & vbCrLf
PageFile = objItem.MaximumSize
Next
Wscript.echo StrMsg
All PCs are XP pro sp1 over IP on... NetWare network (yeah, I know...) .
This Vbscript just reads out pagefile size min,max and current usage. So I can find the incorrectly manual configured PCs (a config best left to the OS). Problem : I have tried various approaches, but I'm still getting one error or another related to security on the target system "permission denied" etc. Works fine local when moniker is changed up (removed).
'Pagefileinfo.vbs'
Option explicit
Dim strMsg, strComputer, objWMIService, colItems, objItem
strComputer = inputbox ("Enter a valid PC netbios name", "Remote page file information retrieval")
' Collect page file info '
Set objWMIService = GetObject("Winmgmts:" _
& "{impersonationLevel=impersonate," _
& "authenticationLevel=pkt," _
& "authority=kerberos}!\\" _
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PageFile")
For Each objItem in colItems
strMsg = strMsg _
& "Initial size : mb " & objItem.InitialSize & vbCrLf _
& "Maximum size : mb " & objItem.MaximumSize & vbCrLf _
& "Current size : mb " & objItem.FileSize \ 1048576 & vbCrLf _
& "___________________" & vbCrLf
PageFile = objItem.MaximumSize
Next
Wscript.echo StrMsg