Listing printers in AD after domain migration

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

We have several W2K print servers that are currently in a
NT4 domain. We are in the process of migrating those
servers to our new AD enabled W2K domain. In the W2K AD
enabled domain, we have set the policies for publishing
printers to "Enabled" (Policies are "Allow printers to be
published to the Directory" and "Automatically publish new
printers in the Active Directory"). We migrated one of
the servers (more or less a test server). The migration
went well -- no real problems. Any new printers that are
created are automatically shared and listed in the AD.
The problem appears to be with existing shared printers.
After the migration, they continue to be shared, however,
they are not automatically set to be listed in the AD (the
check box for the "List in the Directory" option under the
Properties/Sharing tab is left unchecked). We have over
4000 network printers, and do not want to have to touch
each one to make this change. Is there an automated way
to get each shared printer advertised in the AD either
during or after the domain migration? Thanks!
 
--------------------
Content-Class: urn:content-classes:message
From: "Dan" <[email protected]>
Sender: "Dan" <[email protected]>
Subject: Listing printers in AD after domain migration
Date: Mon, 17 May 2004 07:43:52 -0700

We have several W2K print servers that are currently in a
NT4 domain. We are in the process of migrating those
servers to our new AD enabled W2K domain. In the W2K AD
enabled domain, we have set the policies for publishing
printers to "Enabled" (Policies are "Allow printers to be
published to the Directory" and "Automatically publish new
printers in the Active Directory"). We migrated one of
the servers (more or less a test server). The migration
went well -- no real problems. Any new printers that are
created are automatically shared and listed in the AD.
The problem appears to be with existing shared printers.
After the migration, they continue to be shared, however,
they are not automatically set to be listed in the AD (the
check box for the "List in the Directory" option under the
Properties/Sharing tab is left unchecked). We have over
4000 network printers, and do not want to have to touch
each one to make this change. Is there an automated way
to get each shared printer advertised in the AD either
during or after the domain migration? Thanks!
---------------------

This script will publish all shared printers on a machine. Enjoy

--
~~ JASON HALL ~~
~ Performance Support Specialist,
~ Microsoft Enterprise Platforms Support
~ This posting is provided "AS IS" with no warranties, and confers no
rights.
~ Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
~ Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 
Thanks, but I do not see the script code. Did I miss it
somewhere? Please repost response.

Thanks again.
 
--------------------
From: "Dan" <[email protected]>
Subject: RE: Listing printers in AD after domain migration
Date: Wed, 19 May 2004 07:30:47 -0700

Thanks, but I do not see the script code. Did I miss it
somewhere? Please repost response.

Thanks again.
-------------------

'
' This VBS enables printer publishing
'
' Created by Austin Mack. Last modified on 7/25/2003
'
' Note: The command generated for each printer will display an error for
each printer, if
' it is unable to enable publishing for the printer, for example lack
of permissions.
'
' Following link has a list of printer attributes.
'
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/
win32_printer.asp
' Attributes of a Windows printing device are represented by a combination
of flags.
' Shared Attribute = 8 (ie Available as a shared network resource)
'
' If printer name enumerated starts with \\ it is assumed to be printer on
a different print
' server. Alternatively we could verify printer is local by checking the
to see if printer
' name is under
HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\<printername> reigstry
key
'
' A printer name such as "\\clt-prn-01\8100DN@AP1-3469" will results in
' "The arguments are invalid."
' with the current PRINTUI command usage in this script. The PRINTUI.DLL
command has the
' following usage:
' rundll32 printui.dll,PrintUIEntry [options] [@commandfile]
'
' Oprions used in this script are:
' /n[name] printer name
' /Xs set printer settings
'
' Additional PRINTUI.DLL syntax information available by running the
following command
' rundll32 printui.dll,PrintUIEntry /?

Option Explicit
on error resume next

Dim Key 'The dictionary key to each item
Dim objLocator, objService, objEnumerator
Dim objWSH, strComputerName
Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objWSH = CreateObject("WScript.Network")
strComputerName = objWSH.ComputerName

set objLocator = CreateObject("WbemScripting.SWbemLocator")
set objService = objLocator.ConnectServer(strComputerName,"root/cimv2")
set objEnumerator = objService.ExecQuery("SELECT * FROM win32_Printer")

Wscript.echo "A message will be displayed after printer publishing has been
enabled on ALL of the local printers that are shared." & vbcrlf & "Click OK
to continue"
For each key in objEnumerator 'cycle through each printer on the system
if ((key.attributes and 8) = 8 ) then 'Only execute printer is shared
if (left(key.name,2) <> "\\") then 'Only execute if printer is not
a UNC network printer (ie should be local)
'wscript.echo key.name 'Display each printer that is
about to have DS print publishing enabled.
WSHShell.Run("rundll32 printui.dll,PrintUIEntry /Xs /n """ & key.name
& """ attributes +Published")
end if
end if
Next

Wscript.echo "Printer publishing has been enable for the local printers
that were shared on this system"



--
~~ JASON HALL ~~
~ Performance Support Specialist,
~ Microsoft Enterprise Platforms Support
~ This posting is provided "AS IS" with no warranties, and confers no
rights.
~ Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
~ Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 
Back
Top