ADSI:GetObject network path not found reading info other than the current computer name 
Author Message
 ADSI:GetObject network path not found reading info other than the current computer name

I've got the code below from MS website.
Strangely it works only  when the machine being is read is my current
machine.
I execute this from the Domain Controller, it returns "network path not
found..." if Computer.Name is other than the machine where I execute the
script. What could be wrong ??
---------------------------------------------------------
myDomain = "TEST"

Set objDomain = GetObject("WinNT://" & myDomain)
objDomain.Filter = Array("Computer")
For Each Computer in objDomain
    Currentmachine = Computer.Name
    VerifyVersion(CurrentMachine)
Next

Function VerifyVersion(omachine)

Set obj = GetObject("WinNT://" & omachine & ",computer")'** Works when it
reads current machine info, but returns "network path not found" error when
reading another machines in the domain

If (obj.Class = "Computer") Then
    MsgBox "Computer owner: " & obj.owner
    MsgBox "Computer division: " & obj.Division
    MsgBox "Computer operatingSystem: " & obj.OperatingSystem
    MsgBox "Computer operating System Version: " &
obj.OperatingSystemVersion
    MsgBox "Computer processor: " & obj.Processor
    MsgBox "Computer processor Count: " & obj.ProcessorCount
End If

End Function



Wed, 14 Apr 2004 07:18:15 GMT  
 ADSI:GetObject network path not found reading info other than the current computer name
NT boxes with the post SP6a Security Rollup Package (SRP) applied demonstrate this behavior.

Set objDomain = GetObject("WinNT://" & myDomain & "/" & LOGONSERVER)
Set objDomain = GetObject("WinNT://" & LOGONSERVER)

are both workarounds where LOGONSERVER is a variable with the value of the %LOGONSERVER% environment variable.  Use the WshShell.Environment object property or the ExpandEnvironmentStrings method to get the value for LOGONSERVER.

Uninstalling the SRP will also restore normal ADSI behavior but may not be an option.  The uninstall is what I did on an NT workstation when I had this problem.  You probably wouldn't want to uninstall the SRP on a DC.

--
Michael Harris
Microsoft.MVP.Scripting

Quote:

> I've got the code below from MS website.
> Strangely it works only  when the machine being is read is my current
> machine.
> I execute this from the Domain Controller, it returns "network path not
> found..." if Computer.Name is other than the machine where I execute the
> script. What could be wrong ??
> ---------------------------------------------------------
> myDomain = "TEST"

> Set objDomain = GetObject("WinNT://" & myDomain)
> objDomain.Filter = Array("Computer")
> For Each Computer in objDomain
>     Currentmachine = Computer.Name
>     VerifyVersion(CurrentMachine)
> Next

> Function VerifyVersion(omachine)

> Set obj = GetObject("WinNT://" & omachine & ",computer")'** Works when it
> reads current machine info, but returns "network path not found" error when
> reading another machines in the domain

> If (obj.Class = "Computer") Then
>     MsgBox "Computer owner: " & obj.owner
>     MsgBox "Computer division: " & obj.Division
>     MsgBox "Computer operatingSystem: " & obj.OperatingSystem
>     MsgBox "Computer operating System Version: " &
> obj.OperatingSystemVersion
>     MsgBox "Computer processor: " & obj.Processor
>     MsgBox "Computer processor Count: " & obj.ProcessorCount
> End If

> End Function



Wed, 14 Apr 2004 09:00:30 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ADSI: Intermitent Network Path Was Not Found when binding to group

2. The network path was not found error

3. Long Path Names give Runtime error 76 - Path not found

4. Long Path Names give Runtime error 76 - Path not found

5. Error Querying ADSI via VBScript: "The Network Path Was Not Found"

6. Reading the current network speed

7. Reading the current network speed

8. Finding path of current database?

9. To GetObject or Not to GetObject

10. Finding the current programs path and filename

11. How can I read out the current installation and WINDOWS\SYSTEM path

12. Help: Can not find ADSI v2.0 object library for VB

 

 
Powered by phpBB® Forum Software