RE: Find SP2 - [WILDPACKET] by WILDPACKET
WILDPACKET
Wed Nov 30 08:17:08 CST 2005
Thank you ESP for your response.
I am not the scripting guy, ok, I will run this script after making the
appropriate changes, will this script generate a file as output or how will
it show the PCs which are running SP1 only?
Please advise.
"ESP" wrote:
> Yea, but this will. Took me a few minutes to re-write it.
> ESP
>
>
> On Error Resume Next
> Const ADS_SCOPE_SUBTREE = 2
> strContainer = "DC=YourDomain,DC=com"
> Set objConnection = CreateObject("ADODB.Connection")
> Set objCommand = CreateObject("ADODB.Command")
> objConnection.Provider = ("ADsDSOObject")
> objConnection.Open "Active Directory Provider"
> objCommand.ActiveConnection = objConnection
> objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
> objCommand.Properties("Page Size") = 1000
> objCommand.CommandText = _
> "SELECT CN, operatingSystemVersion, operatingSystemServicePack " _
> & "FROM 'LDAP://" & strContainer & "' " _
> & "WHERE objectCategory='computer' " _
> & "AND operatingSystemVersion = '5.1 (2600)' " _
> & "AND operatingSystemServicePack = 'Service Pack 2'"
> Set objRecordSet = objCommand.Execute
> objRecordSet.Sort = "CN"
> objRecordSet.MoveFirst
> Do Until objRecordSet.EOF
> Wscript.Echo
> Wscript.Echo objRecordSet.Fields("CN").Value
> Wscript.Echo String(Len(objRecordSet.Fields("CN").Value), "-")
> Wscript.Echo " " & objRecordSet.Fields("operatingSystemVersion").Value
> Wscript.Echo " " & objRecordSet.Fields("operatingSystemServicePack").Value
> objRecordSet.MoveNext
> Loop
>
>
>
>
>
>
>
> "WILDPACKET" wrote:
>
> > Thank you for your reply.
> >
> > That did not work.
> >
> >
> >
> > "ESP" wrote:
> >
> > > I could be wrong, but if I remember correctly, I believe you use an AND
> > > between these, not ()
> > >
> > > (&(&(&(&(&( WHERE objectCategory=Computer AND operatingSystem=Windows XP
> > > Professional AND operatingSystemServicePack=Service Pack 1))))))
> > >
> > > ESP
> > >
> > >
> > >
> > >
> > > "WILDPACKET" wrote:
> > >
> > > > Any body has a script which will find all the Windows XP Clients running SP2
> > > > our find SP1 in our domain?
> > > >
> > > >
> > > > ******************************
> > > > Have this LDAP Query.
> > > >
> > > > (&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP
> > > > Professional)(!operatingSystemServicePack=Service Pack 1))))))
> > > >
> > > > This query works but also picks up all the XP PCs which are also running
> > > > SP2. I just want the query to pick SP1 PCs. Any ideas any thing wrong with
> > > > this query?
> > > >
> > > > Please advise.
> > > >
> > > > Thank you
> > > >