![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Query AD and for each machine frin out the adobe version VBscript to query AD and for each machine frin out the adobe version. Here is my script: Const ADS_SCOPE_SUBTREE = 2 Const ForWriting = 2 Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") 'Text File Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile("U:\Scripts\Get_Computer_names\AD_Computers_STMDRS_7_7_08.txt", ForWriting) objConnection.Provider = "ADsDSOObject" objConnection.Open "Active Directory Provider" Set objCOmmand.ActiveConnection = objConnection objCommand.CommandText = _ "Select Name, Location from 'LDAP://OU=Desktops,OU=Workstations,OU=legg mason,dc=leggmason,dc=com' " _ & "Where objectClass='computer' AND sAMAccountName='stmts*'" objCommand.Properties("Page Size") = 1000 objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value 'strComputer = objRecordSet.Fields("Name").Value objRecordSet.MoveNext '---------------------------------------------- strComputer = objRecordSet.Fields("Name").Value Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colSoftware = objWMI.ExecQuery( _ "SELECT Version FROM Win32_Product WHERE Name Like 'Adobe %'") For Each objSoftware In colSoftware WScript.echo objSoftware.name & vbtab & _ objSoftware.Version Next '----------------------------------------------------- Loop When I run the script it goes to the first machine and echos the version but when it goes to the second machine I get an error: Microsoft VBScript runtime error: The remote server machine does not exist or is unavailable: 'GetObject' I can ping the second machine and remote to it. Can someone please help me. also I want to ping the machine before it trys to get the version Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Query AD and for each machine frin out the adobe version "freddy" <freddy@xxxxxx> wrote in message news:048CD0A8-22B1-4C06-AFF8-BFC30E35A864@xxxxxx Quote: > VBscript to query AD and for each machine frin out the adobe version. Here > is > my script: > > Const ADS_SCOPE_SUBTREE = 2 > Const ForWriting = 2 > > Set objConnection = CreateObject("ADODB.Connection") > Set objCommand = CreateObject("ADODB.Command") > 'Text File > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFile = > objFSO.CreateTextFile("U:\Scripts\Get_Computer_names\AD_Computers_STMDRS_7_7_08.txt", > ForWriting) > objConnection.Provider = "ADsDSOObject" > objConnection.Open "Active Directory Provider" > > Set objCOmmand.ActiveConnection = objConnection > objCommand.CommandText = _ > "Select Name, Location from 'LDAP://OU=Desktops,OU=Workstations,OU=legg > mason,dc=leggmason,dc=com' " _ > & "Where objectClass='computer' AND sAMAccountName='stmts*'" > objCommand.Properties("Page Size") = 1000 > objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE > Set objRecordSet = objCommand.Execute > objRecordSet.MoveFirst > > Do Until objRecordSet.EOF > Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value > 'strComputer = objRecordSet.Fields("Name").Value > objRecordSet.MoveNext > '---------------------------------------------- > > strComputer = objRecordSet.Fields("Name").Value > Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") > Set colSoftware = objWMI.ExecQuery( _ > "SELECT Version FROM Win32_Product WHERE Name Like 'Adobe %'") > For Each objSoftware In colSoftware > WScript.echo objSoftware.name & vbtab & _ > objSoftware.Version > Next > '----------------------------------------------------- > Loop > > When I run the script it goes to the first machine and echos the version > but > when it goes to the second machine I get an error: Microsoft VBScript > runtime error: The remote server machine does not exist or is unavailable: > 'GetObject' > > I can ping the second machine and remote to it. Can someone please help > me. > also I want to ping the machine before it trys to get the version > > Thanks computers linked here: http://www.rlmueller.net/PingComputers.htm Next, the "objRecordset.MoveNext" statement should be just before the "Loop" statement. Otherwise you will skip the first computer and the name echo'd by the Wscript.Echo command will be different from the computer being connected to. Also, you are retrieving the "Name" property of the computer objects, which may not be the same as the NetBIOS name you need. True, the Name property almost always is the same as the NetBIOS name, but it may not be. I would use the sAMAcountName attribute instead and strip off the trailing "$". The value of the sAMAccountName attribute is always the NetBIOS name of the computer with the character "$" appended to the end. Finally, the "Like" operator may not be supported on all clients. I cannot remember which OS first supported it. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Adobe flashplayer version old? | Software | |||
| Latest Version of Adobe Shockwave | Software | |||
| Machine Query | PowerShell | |||
| Query machine OS's within an OU | PowerShell | |||
| Can't run Adobe Reader, Any version. | Vista General | |||