Connect to a machine that is not in a domain
From: Dave Coate (coateds_at_comcast.net)
Date: 02/25/05
- Next message: alexbalaev_at_yahoo.com: "Re: Connect to a machine that is not in a domain"
- Previous message: Jean Cyr: "Re: StdRegProv GetDWORDValue works in XP but returns 0x8004155 (WBEM_E_METHOD_NOT_IMPLEMENTED) in 2000"
- Next in thread: alexbalaev_at_yahoo.com: "Re: Connect to a machine that is not in a domain"
- Reply: alexbalaev_at_yahoo.com: "Re: Connect to a machine that is not in a domain"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 24 Feb 2005 22:01:31 -0800
I am trying to connect to a server that is not in a domain from a
workstation that is in a domain and I can not seem to get it to work. Here
is my (vb.net) code:
Dim ComputerName As String = txtInput.Text
Dim UserName As String = txtUserName.Text
Dim Password As String = txtPassword.Text
Dim co As New ConnectionOptions
Dim scope As ManagementScope
Dim strScope As String = "\\" & ComputerName & "\root\cimv2"
With co
.Username = UserName
.Password = Password
.Impersonation = ImpersonationLevel.Impersonate
End With
scope = New ManagementScope(strScope)
'Test Connection
Try
scope.Connect()
txtOutput.Text = "Connected"
Catch ex As Exception
'There was an error connecting to WMI
txtOutput.Text = ex.Message
End Try
I am using the format machinename\username for UserName. I can use this code
to provide alternate credentials when connecting to a computer in within the
domain in which my workstation is a member, but I can not connect to a
computer that is not in that domain. The Exception message I get back is
Access is Denied. The account I am trying to connect with is the
administrator account. I am able to use this account to connect via the WMI
CIM Studio. So WMI seems to be fine and the credentials have the required
access.
Is there another ConnectionOption I should be using?
What am I doing wrong?
- Next message: alexbalaev_at_yahoo.com: "Re: Connect to a machine that is not in a domain"
- Previous message: Jean Cyr: "Re: StdRegProv GetDWORDValue works in XP but returns 0x8004155 (WBEM_E_METHOD_NOT_IMPLEMENTED) in 2000"
- Next in thread: alexbalaev_at_yahoo.com: "Re: Connect to a machine that is not in a domain"
- Reply: alexbalaev_at_yahoo.com: "Re: Connect to a machine that is not in a domain"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|