M
Mikael Jansson
Hi,
Is it possible with WMI to remotely connect to a computer that is not member
of a domain, I have tried the script below with .connectserver but when
running it on a computer not member of a domain I get Access denied even if
I enabled the Remote enable flag in the security of WMI control for a user.
here is the script that runs just fine on a domain computer but not on a
non-domain computer (from a non-domain member computer)
------- script start ----------------
Const intMin = 3600
strComputer = "10.0.0.12"
strDomain = ""
Wscript.StdOut.Write "Please enter your user name:"
strUser = Wscript.StdIn.ReadLine
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()
Wscript.Echo
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, _
"root\CIMV2", _
strUser, _
strPassword, _
, _
"NTLMDomain:" + strDomain)
' list info about printers
set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_printer",,48)
For Each objItem in colItems
WScript.Echo "Name: " & objItem.name & VBNewLine _
& "Description: " & objItem.Description & VBNewLine _
& "DriverName: " & objItem.DriverName
WScript.Echo
Next
-------------------- script end ------------------
br
/ Mikael
Is it possible with WMI to remotely connect to a computer that is not member
of a domain, I have tried the script below with .connectserver but when
running it on a computer not member of a domain I get Access denied even if
I enabled the Remote enable flag in the security of WMI control for a user.
here is the script that runs just fine on a domain computer but not on a
non-domain computer (from a non-domain member computer)
------- script start ----------------
Const intMin = 3600
strComputer = "10.0.0.12"
strDomain = ""
Wscript.StdOut.Write "Please enter your user name:"
strUser = Wscript.StdIn.ReadLine
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()
Wscript.Echo
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, _
"root\CIMV2", _
strUser, _
strPassword, _
, _
"NTLMDomain:" + strDomain)
' list info about printers
set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_printer",,48)
For Each objItem in colItems
WScript.Echo "Name: " & objItem.name & VBNewLine _
& "Description: " & objItem.Description & VBNewLine _
& "DriverName: " & objItem.DriverName
WScript.Echo
Next
-------------------- script end ------------------
br
/ Mikael