The Sapien dudes one of our sponsors for the Summer Scripting Games even gave him a flying script monkey. Someone nabbed it from our booth, but Craig politely retrieved it from the nabber. Ed claims he was too busy talking to people at the Scripting Guys booth and being driven crazy by the TechNet Plus slot machine to do any writing last week. We swear. This week we will examine printing. There are lots of resources related to printing on the TechNet Script Center.
There is a collection of Hey, Scripting Guy! We have almost 50 scripts in the printer section of the Script Center Script Repository. There are also almost 50 scripts in the printer section of the Community-Submitted Scripts Center. We have some good technical information about printing in the Scripting Guide.
All those resources are in VBScript. We hope that you will enjoy it, and use it in good health. If you want to know how it works, read on. Otherwise, we will see you tomorrow. Printer connections are seen under Printers in Control Panel:. The first parameter is the computer parameter. This is used to hold the name of the computer that will be queried for the list of shared printers. The second parameter is the printerpath parameter that is used to specify the name of the printer that will be added.
The last parameter is a switched parameter list, which is used to provide a list of all the shared printers from the destination computer.
The param statement is seen here:. The first function to be created is the Add-PrinterConnection function. When the Add-PrinterConnection function is called, the first thing that happens is the Write-Host cmdlet is used to display a message in cyan that states the printer is being added. This is seen here:. This means that it must be called from the management class itself, and not from an instance of the class.
When you pipe the management object to the Get-Member cmdlet, you are presented with a listing of methods and properties similar to the one in Table 1. By default, if you enable the Group Policy Computer location setting, the default location that you entered appears in the Location field.
Printer Browsing: If you enable this setting, the print subsystem announces shared printers for printer browsing. You should disable this setting if you do not want the print subsystem to add shared printers to the browse list. If this setting is not configured, shared printers are not added to the browse list if a Directory service is available but are added if a Directory service is unavailable.
Prune printers that are not automatically republished: This setting determines whether printers can be pruned from the directory. It is usually best to leave this setting unconfigured. However, if you find that printers are being pruned even though the computer from which they are published is functioning and on the network, you can enable this policy to prevent the pruning service from deleting the published printers during network outages or situations in which dial-up links that are up only intermittently are used.
To prevent printers from being removed from Active Directory, enable this policy, and retain the default selection of Never in the Prune non-republishing printers list. Web-based printing: This policy bit is designed for administrators to disable Internet printing entirely. When this policy bit is selected, none of the shared printers on the server are published to the web, and none of the shared printers are able to accept incoming jobs from other clients by using HTTP.
MSC, and then press Enter. Right-click the newly created Group Policy Object, and then click Edit. This opens Group Policy Management Editor. The following additional settings can be enabled under Computer Configuration :. Add Printer wizard - Network scan page Managed network : This policy sets the maximum number of printers of each type that the Add Printer wizard will display on a computer on a managed network when the computer is able to reach a domain controller for example, a domain-joined laptop on a corporate network.
Add Printer wizard - Network scan page Unmanaged network : This policy sets the maximum number of printers of each type that the Add Printer wizard will display on a computer on an unmanaged network when the computer is not able to reach a domain controller for example, a domain-joined laptop on a home network.
Always render print jobs on the server: When printing through a print server, determines whether the print spooler on the client will process print jobs itself or pass them on to the server to do the work.
This policy setting affects printing to a Windows print server only. Execute print drivers in isolated processes: This policy setting determines whether the print spooler will execute print drivers in an isolated or separate process. When print drivers are loaded in an isolated process or isolated processes , a print driver failure will not cause the print spooler service to fail. Extend Point and Print connection to search Windows Update: This policy setting allows you to manage where client computers search for Point and Print drivers.
If you enable this policy setting, the client computer will continue to search for compatible Point and Print drivers from Windows Update after it fails to find the compatible driver from the local driver store and the server driver cache.
Only use Package Point and print: This policy restricts client computers to use package point and print only. If this setting is enabled, users will be able to point and print only to printers that use package-aware drivers.
When using package point and print, client computers will check the driver signature of all drivers that are downloaded from print servers. Override print driver execution compatibility setting reported by print driver: This policy setting determines whether the print spooler will override the Driver Isolation compatibility that is reported by the print driver. This enables executing print drivers in an isolated process even if the driver does not report compatibility.
If you enable this policy setting, the print spooler will ignore the Driver Isolation compatibility flag value that is reported by the print driver. Package Point and print - Approved servers: Restricts package point and print to approved servers. This policy setting restricts package point and print connections to approved servers.
This setting applies only to Package Point and Print connections and is completely independent from the "Point and Print Restrictions" policy that governs the behavior of non-package point and print connections. Clinet that are running Windows Vista or a later version of Windows will try to make a non-package point and print connection any time that a package point and print connection fails.
This includes attempts that are blocked by this policy. Administrators may have to set both policies to block all print connections to a specific print server. If this setting is enabled, users will be able to package point and print only to print servers that are approved by the network administrator.
Point and Print Restrictions: This policy setting controls the client Point and Print behavior, including the security prompts for Windows Vista computers. The policy setting applies only to non-Print Administrator clients, and only to computers that are members of a domain. When the policy setting is enabled, the following conditions obtain:. Windows XP and later clients will only download print driver components from a list of explicitly named servers.
If a compatible print driver is available on the client, a printer connection will be made. If a compatible print driver is not available on the client, no connection will be made. You can configure Windows Vista clients so that security warnings and elevated command prompts do not appear when users Point and Print, or when printer connection drivers need to be updated. When the policy setting is not configured, the following conditions obtain:. Windows Vista computers will show a warning and an elevated command prompt when users create a printer connection to any server using Point and Print.
Windows Vista computers will show a warning and an elevated command prompt when an existing printer connection driver needs to be updated. Windows Server and Windows XP client computers can create a printer connection to any server in their forest using Point and Print.
When the policy setting is disabled, the following conditions obtain:. Windows Vista client computers can create a printer connection to any server by using Point and Print. Windows Vista computers will not show a warning or an elevated command prompt when users create a printer connection to any server by using Point and Print.
Windows Vista computers will not show a warning or an elevated command prompt when an existing printer connection driver has to be updated. Windows Server and Windows XP client computers can create a printer connection to any server by using Point and Print. But after you install the printer through control panel and then use the API it works. I assume this is something to do with the way printer installation works with vista. Thanks in advance. The AddPrinterConnection call should not hang.
There are no changes in this API. Your old code should work almost in same way as before. There are changes in printer driver installation. Now you may see a prompt for installing driver — and this was added recently in Vista - after Beta2. I had faced the similar problem and fixed using this call.
AddWindowsPrinterConnection2 does not seem to be available to vbscript on my xp workstation. Any other way to install on an xp client a shared printer that's installed on a vista64 server?
0コメント