![Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/733/36700733/b_36700733.jpg)
上QQ阅读APP看书,第一时间看更新
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