Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can authenticate to computer, but cannot connect to registry

Status
Not open for further replies.

JustScriptIt

Technical User
Oct 28, 2011
73
US
I am creating a script such that it deletes a registry value.

First, I make sure I can ping it.
Then, I make sure I can connect to registry value.

Out of 20 computers, 9 of them are pingable, and two of them can connect to registry value.

However, out of curiosity, I rdp'd into one of the computers whose registry I cannot access. Turns out, I can authenticate to them.

How is it possible to authenticate to a computer, yet not access the registry object?

Here is main part of script

Code:
If Ping(strComputer) then
      wscript.echo "We can ping " & strComputer & " resolving to " & strName
  
   'Can we connect to registry?
    On Error Resume Next

    Set oReg=GetObject( _
    "winmgmts:{impersonationLevel=impersonate}!\\" &_
     strComputer & "\root\default:StdRegProv")


   If (Err.Number <> 0) Then
	HandleError()
	strError = "Cannot connect to registry"
    Else
       wscript.echo "No registry error " & strComputer
       wscript.echo
    End If 'corresponds with If (Err.Number <> 0)




  End if 'corresponds with If Ping

and here is error handling code

Code:
Sub HandleError()
     On Error Goto 0
     Err.Clear 
     bErrorFound = True
End Sub

Please advise? Or, is there another way to determine whether we can authenticate to a cmmputer.

Thanks!
 
By the way

1. I am able to RDP into the remote machine

2. When I open registry editor on my machine, I can connect to the machine.

Perhaps this is a privilige issue? Can you guide?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top