SHARE
TWEET

Untitled

a guest Aug 18th, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Why is a Remote WMI call to Win32_Printer Coming Back With An Empty Set For Some Machines?
  2. strComputer = "nnn.nnn.nnn.nnn"
  3. username = "DOMAINsuperuser"
  4. password = "thisisaverygoodpassword"
  5.  
  6. Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
  7. objSWbemLocator.Security_.ImpersonationLevel = 3
  8. objSWbemLocator.Security_.AuthenticationLevel = 6
  9. Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, "rootcimv2", username, password)
  10. Set colSWBemObjectSet = objSWbemServices.ExecQuery("Select * From Win32_Printer")
  11. WScript.Echo colSWBemObjectSet.Count & " Found."
  12. For Each objPrinter in colSWBemObjectSet
  13.     For Each Property in objPrinter.Properties_
  14.         If TypeName(Property.Value) = "Variant()" Then
  15.             Wscript.Echo """" & Property.Name & """, """ & TypeName(Property.Value) & """, ""Skipping ..."""
  16.         Else
  17.             Wscript.Echo """" & Property.Name & """, """ & TypeName(Property.Value) & """, """ & Property.Value & """"
  18.         End If
  19.     Next
  20. Next
  21.    
  22. IWbemServices::Connect
  23. Start IWbemServices::ExecQuery - Select * from __ClassProviderRegistration
  24. Start IWbemServices::GetObject - __Win32Provider.Name="WmiPerfClass"
  25. Start IWbemServices::ExecQuery - references of {__Win32Provider.Name="WmiPerfClass"}
  26. Start IWbemServices::GetObject - Win32_Printer
  27. Start IWbemServices::ExecQuery - Select * From Win32_Printer
  28. Provider::CreateInstanceEnum - Win32_Printer
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top