From my own PC, I am trying to run the following script against all PCs in my
network to get lists of what software is running on each PC. The script works
when run against Windows 2000 PCs, but does not when I try to run it against
Windows XP machines. I get the following error message: (taken directly from
the CMD output)

D:\Trashcan>cscript test.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

D:\Trashcan\test.vbs(11, 1) Microsoft VBScript runtime error: The remote
server
machine does not exist or is unavailable: 'GetObject'


I am not familiar with scripting against XP PCs. Is there a certain
permission I should enable on XP PC's to allow them to be "controlled" by a
VBS script? Any thoughts will be most appreciated. Thanks.


Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "rpiecyk-xp"
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"

Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
WScript.Echo "Installed Applications" & VbCrLf
For Each strSubkey In arrSubkeys
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
strEntry1a, strValue1)
If intRet1 <> 0 Then
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry1b, strValue1
End If
If strValue1 <> "" Then
WScript.Echo VbCrLf & "Display Name: " & strValue1
End If
objReg.GetStringValue HKLM, strKey & strSubkey, _
strEntry2, strValue2
If strValue2 <> "" Then
WScript.Echo "Install Date: " & strValue2
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry3, intValue3
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry4, intValue4
If intValue3 <> "" Then
WScript.Echo "Version: " & intValue3 & "." & intValue4
End If
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
strEntry5, intValue5
If intValue5 <> "" Then
WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
End If
Next

Re: Error Scripting XP PCs (but works on 2000 PCs) by maximillianx

maximillianx
Mon Jun 12 08:24:22 CDT 2006

Do your XP machines have the firewall enabled perhaps?

Rob

"Romual Piecyk" <RomualPiecyk@discussions.microsoft.com> wrote in message
news:AAE77B50-DC66-4228-8F53-280ACC7C9377@microsoft.com...
> From my own PC, I am trying to run the following script against all PCs in
> my
> network to get lists of what software is running on each PC. The script
> works
> when run against Windows 2000 PCs, but does not when I try to run it
> against
> Windows XP machines. I get the following error message: (taken directly
> from
> the CMD output)
>
> D:\Trashcan>cscript test.vbs
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
>
> D:\Trashcan\test.vbs(11, 1) Microsoft VBScript runtime error: The remote
> server
> machine does not exist or is unavailable: 'GetObject'
>
>
> I am not familiar with scripting against XP PCs. Is there a certain
> permission I should enable on XP PC's to allow them to be "controlled" by
> a
> VBS script? Any thoughts will be most appreciated. Thanks.
>
>
> Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
> strComputer = "rpiecyk-xp"
> strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
> strEntry1a = "DisplayName"
> strEntry1b = "QuietDisplayName"
> strEntry2 = "InstallDate"
> strEntry3 = "VersionMajor"
> strEntry4 = "VersionMinor"
> strEntry5 = "EstimatedSize"
>
> Set objReg = GetObject("winmgmts://" & strComputer & _
> "/root/default:StdRegProv")
> objReg.EnumKey HKLM, strKey, arrSubkeys
> WScript.Echo "Installed Applications" & VbCrLf
> For Each strSubkey In arrSubkeys
> intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
> strEntry1a, strValue1)
> If intRet1 <> 0 Then
> objReg.GetStringValue HKLM, strKey & strSubkey, _
> strEntry1b, strValue1
> End If
> If strValue1 <> "" Then
> WScript.Echo VbCrLf & "Display Name: " & strValue1
> End If
> objReg.GetStringValue HKLM, strKey & strSubkey, _
> strEntry2, strValue2
> If strValue2 <> "" Then
> WScript.Echo "Install Date: " & strValue2
> End If
> objReg.GetDWORDValue HKLM, strKey & strSubkey, _
> strEntry3, intValue3
> objReg.GetDWORDValue HKLM, strKey & strSubkey, _
> strEntry4, intValue4
> If intValue3 <> "" Then
> WScript.Echo "Version: " & intValue3 & "." & intValue4
> End If
> objReg.GetDWORDValue HKLM, strKey & strSubkey, _
> strEntry5, intValue5
> If intValue5 <> "" Then
> WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & "
> megabytes"
> End If
> Next



Re: Error Scripting XP PCs (but works on 2000 PCs) by RomualPiecyk

RomualPiecyk
Mon Jun 12 08:59:02 CDT 2006



"maximillianx" wrote:

> Do your XP machines have the firewall enabled perhaps?
>
> Rob
>


Yes, they do, but all the File and Sharing ports have a custom rule that
allows all traffic from the network I am trying to reach them from. I am able
to open the local C$ share of each machine and also connect to each one with
a remote desktop control program (DameWare) so I know the rule is configured
right.