Hi,
I want to change the description of a printer
in ActiveDirectory with VBScript.
The description should be the same like the attribut driverName
Is it right that I must change this description with WMI
on the server the printer is shared an not in ActiveDirectory ?
This is my code to get the description,
But how to write the description
(only if it's not WMI but writing directly in AD) ?
'-------------------------------------------------------------------
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select description,drivername, serverName from
'LDAP://OU=OUNAME,DC=DCNAME1,DC=DCNAME2' where objectClass='printQueue'
and serverName = '*Servername*'"
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo objRecordSet.Fields("drivername").Value
Description = objRecordSet.Fields("description")
If NOT IsEmpty(description) Then
For Each strdescription In description
Wscript.Echo strdescription
Next
end if
objRecordSet.MoveNext
Loop
objConnection.close
'-------------------------------------------------------------------
Thanks