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

Re: Change the description of printers in ActiveDirectory by ThatsIT

ThatsIT
Sun Jan 27 07:16:31 CST 2008

should get and idea from one of these scripts
http://dev.thatsit.net.au/samples/wsh/printing/servers/

"Maurice Schmitt" <Maurice.Schmitt@gmx.de> wrote in message
news:erelNmCYIHA.3556@TK2MSFTNGP02.phx.gbl...
> 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


Re: Change the description of printers in ActiveDirectory by Maurice

Maurice
Mon Jan 28 03:52:08 CST 2008

ThatsIT.net.au schrieb:
> should get and idea from one of these scripts
> http://dev.thatsit.net.au/samples/wsh/printing/servers/
>


Thanks for your answer, but:

If I change the description in ADSI Edit:
"Insufficient access tights to perform the operation"

If I try to change any attribut with VBScript:
"Active Directory: General access denied error"

I've the rights to change in AD, I think it's not possible
with printers, because the description or location is updated in AD
when I change the settings on the server where the printer is shared.

But I don't know if thats right ?