After you create and share a printer, as shown in the previous recipe, you can also publish it to the Active Directory. When you publish a printer, you can also specify a physical location for the printer. Your users can then search for published printers based on location, as well as on capabilities (such as color printers). In this recipe, you publish the printer you created in the previous recipe and examine the results.
Before running this recipe, you need to have the PSRV printer server set up (you did this in the Installing and sharing printers recipe). Additionally, you need SalesPrinter1
created.
$Printer = Get-Printer -Name SalesPrinter1
$Printer | Format-Table -Property Name, Published
$Printer | Set-Printer -Location '10th floor 10E4' $Printer | Set-Printer -Shared $true -Published $true
Get-Printer -Name SalesPrinter1 | Format-Table -Property Name, Location, Drivername, Published
Get-SmbShare -Name SalesPrinter1
In step 1, you retrieved the printer details for the SalesPrinter1
printer that you set up in the Installing and sharing printers recipe. There's no output from this step.
In step 2, you display the printer details and can see that the printer is unpublished, which looks like this:
In step 3, you use the Set-Printer
cmdlet to set the location details for the printer and publish the printer in AD. This step updates the printer details in the AD and produces no output.
In step 4, you view the details of the printer, which looks like this:
Publishing a printer to AD allows users to locate printers near them using the Add Printer dialog to search for published printers. For example, if you log into the client computer, CL1
, you can get to this dialog by clicking Start | Settings | Devices
|
Printers & scanners to bring up the Add printers & scanners dialog. From this dialog box, click Add a printer or scanner. Wait until the search is complete, then click on The printer that I want isn't listed, which brings up the Add Printer dialog, like this:
From this dialog box, click on Next to bring up the Find Printers dialog, which looks like this:
3.138.37.151