- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Thomas Lee
- 60字
- 2021-07-02 18:15:57
How to do it...
- Get the printer to publish and store the returned object in $Printer:
$Printer = Get-Printer -Name SGCP1
- Observe the publication status:
$Printer | Format-Table -Property Name, Published
- Publish the printer to AD:
$Printer | Set-Printer -Published $true ` -Location '10th floor 10E4'
- View the updated publication status:
Get-Printer -Name SGCP1 | Format-Table -Property Name, Published, Location