Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retrive operatingSystem from Active Directory

3 views
Skip to first unread message

Jesper Ravn

unread,
Oct 29, 2009, 9:53:45 AM10/29/09
to

Hello

How can i retrive operatingSystem from a specific computer/server.
Please see my code below.

Dim StrComputer as string
StrComputer = "SQLserver01"

adoCommand.CommandText = "SELECT Name, operatingSystem FROM " _
& "'LDAP://DC=DOMAIN,DC=COM' WHERE objectClass='computer' " _
& "and Name = " & StrComputer & ""

adoRecordset = adoCommand.Execute

Dim strOperatingSystem As String
strOperatingSystem = adoRecordset.Fields("operatingSystem").Value

It fails when running the execute command.
Hopefully you can me in the right direction.

Thanks;

/Jesper



Jesper Ravn

unread,
Oct 29, 2009, 11:28:35 AM10/29/09
to
"Jesper Ravn" <jespe...@hotmail.com> skrev i meddelelsen
news:#sp888JW...@TK2MSFTNGP06.phx.gbl...

Ok, I found the solution. It was a syntax error

adoCommand.CommandText = "Select Name, operatingSystem From " & _
LDAP://DC=Domain,DC=Com' Where objectClass='computer'" & _
" and Name = '" & StrComputer & "'"

/Jesper

Pegasus [MVP]

unread,
Oct 29, 2009, 1:21:49 PM10/29/09
to

"Jesper Ravn" <jespe...@hotmail.com> wrote in message
news:e8rxEyKW...@TK2MSFTNGP05.phx.gbl...

Your updated code still has syntax problems - you've got unmatched
single/double quotes.


0 new messages