Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Why is a Remote WMI call to Win32_Printer Coming Back With An Empty Set For Some Machines?
- strComputer = "nnn.nnn.nnn.nnn"
- username = "DOMAINsuperuser"
- password = "thisisaverygoodpassword"
- Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
- objSWbemLocator.Security_.ImpersonationLevel = 3
- objSWbemLocator.Security_.AuthenticationLevel = 6
- Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "rootcimv2", username, password)
- Set colSWBemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_Printer")
- WScript.Echo colSWBemObjectSet.Count & " Found."
- For Each objPrinter in colSWBemObjectSet
- For Each Property in objPrinter.Properties_
- If TypeName(Property.Value) = "Variant()" Then
- Wscript.Echo """" & Property.Name & """, """ & TypeName(Property.Value) & """, ""Skipping ..."""
- Else
- Wscript.Echo """" & Property.Name & """, """ & TypeName(Property.Value) & """, """ & Property.Value & """"
- End If
- Next
- Next
- IWbemServices::Connect
- Start IWbemServices::ExecQuery - Select * from __ClassProviderRegistration
- Start IWbemServices::GetObject - __Win32Provider.Name="WmiPerfClass"
- Start IWbemServices::ExecQuery - references of {__Win32Provider.Name="WmiPerfClass"}
- Start IWbemServices::GetObject - Win32_Printer
- Start IWbemServices::ExecQuery - Select * From Win32_Printer
- Provider::CreateInstanceEnum - Win32_Printer
Add Comment
Please, Sign In to add comment