System command

pubprn command

Publishes a printer to the Active Directory Domain Services. This guide lists the documented syntax and parameters for pubprn; check Microsoft Learn for version, role and execution-context requirements.

Availability: Microsoft Learn command reference spanning Windows client and Windows Server releases; some entries are legacy, role-specific, optional-feature or interactive subcommands.中文

Documented syntax

cscript pubprn {<servername> | <UNCprinterpath>} LDAP://CN=<container>,DC=<container>

The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.

Examples

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

cscript pubprn Server1 LDAP://CN=MyContainer,DC=MyDomain,DC=company,DC=Com

Example from the linked Microsoft Learn article. Check its paths, targets and availability before adapting it.

cscript pubprn \\Server1\Laserprinter1 LDAP://CN=MyContainer,DC=MyDomain,DC=company,DC=Com

Parameters, options and clauses

Option / clauseDescription
<servername>Publish printers hosted by the specified Windows server.
<UNCprinterpath>Publish a shared printer using its UNC path.
LDAP://CN=<container>,DC=<container>Specify the Active Directory Domain Services container where the printer is published.
-?Display command help.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory