"Jesper Ravn" <> skrev i meddelelsen
news:#...
> 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.
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
|