Computer and Software Support


prnmngr.vbs

This page is from Microsoft

Updated: January 21, 2005

Adds, deletes, and http://technet2.microsoft.com /windowsserver/en/library/552ed70a-208d-48c4-8da8-2e27b530eac71033.mspx?mfr=truelists printers or printer connections, in addition to setting and displaying the default printer. Used without parameters, prnmngr.vbs displays command-line help for the prnmngr.vbs command.

 

To add a local printer

 
Syntax
cscript prnmngr.vbs-a-pPrinterName [-sRemoteComputer] -mDriverName-rPortName [-uUserName-wPassword]
Parameters
-a
Required. Specifies that you want to add a local printer.
-sRemoteComputer
Specifies, by name, the remote computer to which you want to add a local printer. If you do not specify a computer, the printer is added to the local computer.
-pPrinterName
Required. Specifies, by name, the local printer that you want to add.
-mDriverName
Required. Specifies, by name, the driver for the local printer you want to add. Drivers are often named for the model of printer they support. See the printer documentation for more information.
-rPortName
Required. Specifies the port to which the printer is connected. If this is a parallel or a serial port, use the ID of the port (for example, LPT1 or COM1). If this is a TCP/IP port, use the port name that was specified when the port was added. For more information, see Related Topics.
-uUserName-wPassword
Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer to which you want to add a local printer. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").
Examples
To add a printer named ColorPrinter_2 that is connected to LPT1 on the local computer and requires a printer driver called Color Printer Driver1, type:

cscript prnmngr.vbs -a -p ColorPrinter_2 -m "Color Printer Driver1" -r lpt1:

To add a printer connection

 
Syntax
cscript prnmngr.vbs-ac-pPrinterName
Parameters
-ac
Required. Specifies that you want to add a printer connection.
-pPrinterName
Required. Specifies, by name, the printer for which you want to add a connection.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Return to Top

 

To delete a printer

 
Syntax
cscript prnmngr.vbs-d-pPrinterName [-uUserName-wPassword] [-sRemoteComputer]
Parameters
-d
Required. Specifies that you want to delete a printer.
-pPrinterName
Required. Specifies, by name, the printer that you want to delete.
-uUserName-wPassword
Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer from which you want to delete a printer. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.
-sRemoteComputer
Specifies, by name, the remote computer to which you want to add a local printer. If you do not specify a computer, the printer is added to the local computer.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").
 
Examples
To delete the printer named ColorPrinter_2 from the remote computer named HRServer, type:

cscript prnmngr.vbs -d -s HRServer -p ColorPrinter_2

Return to Top

 

To delete all of the printers from a computer

 
Syntax
cscript prnmngr.vbs-x [-sRemoteComputer] [-uUserName] [-wPassword]
Parameters
-x
Required. Specifies that you want to delete all printers from a computer.
-sRemoteComputer
Specifies, by name, the remote computer from which you want to delete all printers. If you do not specify a computer, all printers are deleted from the local computer.
-uUserName-wPassword
Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer from which you want to delete all printers. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

 

To display the default printer

 
Syntax
cscript prnmngr.vbs-g
Parameters
-g
Required. Specifies that you want to display the default printer.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Return to Top

To set the default printer

 
Syntax
cscript prnmngr.vbs-t-pPrinterName
Parameters
-t
Required. Specifies that you want to set the default printer.
-pPrinterName
Required. Specifies, by name, the printer that you want to set as the default printer.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Return to Top

 

To list all of the printers for a computer

 
Syntax
cscript prnmngr.vbs-l [-sRemoteComputer] [-uUserName-wPassword]
Parameters
-l
Required. Specifies that you want to list all the printers for a computer.
-sRemoteComputer
Specifies, by name, the remote computer for which you want to list printers. If you do not specify a computer, the printers added to the local computer are listed.
-uUserName-wPassword
Specifies an account with permissions to connect by using Windows Management Instrumentation (WMI) services to the computer for which you want to list printers. All members of the Administrators group for that computer have these permissions, but the permissions can also be granted to other users. If you do not specify an account, you must be logged on under an account with these permissions for the command to work. For more information on WMI, see Related Topics.
/?
Displays help at the command prompt.
Remarks
  • This command starts a script that is located in the systemroot\system32 directory. You must type this command at a command prompt with that directory as the current directory, or you must type the full path to that directory at the beginning of the cscript command.
  • If the information that you supply contains spaces, use quotation marks around the text (for example, "Computer Name").

Return to Top

 

Formatting legend

Format Meaning
Italic Information that the user must supply
Bold Elements that the user must type exactly as shown
Ellipsis (...) Parameter that can be repeated several times in a command line
Between brackets ([]) Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} Set of choices from which the user must choose only one
Courier font Code or program output