Remote WMI connect to a computer not member of a domain? (only workgroup)

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
 
T

Torgeir Bakken \(MVP\)

Mikael said:
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 ----------------
(snip)
Hi,

Yes, WMI supports connecting to computers not in a domain.

If the remote computer is a WinXP computer, it could be a
ForceGuest issue, more about this here:

http://groups.google.co.uk/group/mi...admin/msg/fa79ab12b3e2c2f8?dmode=source&hl=en
 
M

Mikael Jansson

Torgeir, you are the man with big M.

first of all you reply within 5 minutes from my question and upon that....

YOU SOLVED MY PROBLEM !!! :)

a million thanks to you!

/ Mikael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top