Powershell: Enable ‘List in directory’ for all the printers

Following command will enable the option ‘List in directory’ under printer properties to published the shared printers in active directory.

For local computer:
Get-Printer | Set-Printer -Published $true

For remote computer:
Get-Printer -ComputerName RemoteServer | Set-Printer -Published $true