To create a correctly formatted Printer GPP, follow the below guidelines.
Based on experience, it is highly recommended to deploy network printers from Print Management on the print server via Group Policy. That being said, there is scenarios where GPP can and should be used to deploy printers. This script removes removes a few nuisance printers, but can be updated to deploy local or port computer based printers if there is a requirement. It is likely not worth the effort to deploy unique printers with this script, but it can be done.
Computer Printer GPP
Local Printers
$XMLItemAttributes = ("clsid","disabled","name","status","image","changed","uid","bypassErrors","desc","removePolicy","PRIMARYEND","action","name","port","path","default","location","comment","RUNONCE","SUBEND")
Port Printers
$XMLItemAttributes = ("clsid","disabled","name","status","image","changed","uid","bypassErrors","desc","removePolicy","PRIMARYEND","ipAddress","action","location","localName","comment","default","skipLocal","useDNS","useIPv6","path","deleteAll","lprQueue","snmpCommunity","protocol","portNumber","doubleSpool","snmpEnabled","snmpDevIndex","RUNONCE","SUBEND")
User Printer GPP
Code only provided for computer based management of GPP printers.
$XMLItemAttributes values
clsid - This is the clsid of the GPP local and port printer items. GPP clsid Reference
disabled - Enabled
or Disabled
. Icon color is indicating the action taken when pressed. On an enabled GPP it is red and on a disabled GPP is green.
name - Name of the GPP item.
status - A field that is updated when the value of the GPP is updated. Can be the same text as name or value.
image - This is the image that is shown in the Group Policy GUI. Image Reference
changed - Date the GPP is set. $DateUni = (Get-Date -Format u).TrimEnd('Z').
uid - Generate GUID. $GUID = ([guid]::NewGuid()).ToString().ToUpper().
bypassErrors - Sets the Stop processing items in this extension is an error occurs. Value of 1 is unchecked, value of 0 is checked.
desc Set's the Description text. By default includes the $FirmName and $Date. Useful to add additional notes about what the setting actually controls.
removePolicy - Sets the Remove this item when it is no longer applied. Value of 1 is checked, value of 0 is unchecked. Only works with Replace action.
PRIMARYEND - Internal script header to indicate XML subnode.
Local Printer


action - Identifies the action for the GPP.
| Action | Value |
|---|---|
| Create | C |
| Replace | R |
| Update | U |
| Delete | D |
name - The name of the printer.
port - The port of the printer. The GPP choices are: LPT1-4, COM1-4 USB001-4.
path - A qualified UNC path of the location printer for sharing.
default - Sets as the default printer. Value of 1 is checked, value of 0 is unchecked.
deleteAll - No use of this setting on the local printer, but GPP adds this to each local printer item.
location - Fills in the location field.
comment - Fills in the comment field.
RUNONCE - Signifies if the GPP should be set to Apply once and do not reapply.
SUBEND - Internal script header to indicate XML subnode ending.
Port Printer


ipAddress - IP address of the printer.
action - Identifies the action for the GPP.
| Action | Value |
|---|---|
| Create | C |
| Replace | R |
| Update | U |
| Delete | D |
location - Fills in the location field.
localName - Identifies the Local Name of the printer.
comment - Fills in the comment field.
default - Sets as the default printer. Value of 1 is checked, value of 0 is unchecked.
skipLocal - Sets the ..only is a local printer is not present option. Value of 1 is checked, value of 0 is unchecked.
useDNS - Sets the Use DNS Name option. Value of 1 is checked, value of 0 is unchecked.
useIPv6 - Sets the Use an IPv6 address option. Value of 1 is checked, value of 0 is unchecked.
path - A qualified UNC path of the location printer for sharing.
deleteAll - Sets the Delete all IP printer connections option. Value of 1 is checked, value of 0 is unchecked.
lprQueue - If the protocol selected is LPR, set the LPR Settings –> Queue Name.
snmpCommunity - If SNMP is enabled, set the Community Name
protocol - Sets the protocol for the printer, either TCP/IP (Raw) or LPR. Valid values are PROTOCOL_RAWTCP_TYPE or PROTOCOL_LPR_TYPE.
portNumber - If TCP/IP is selected, set the port. Default is 9100.
doubleSpool - If LPR is selected, sets the LPR Byte Counting Enabled option. Value of 1 is checked, value of 0 is unchecked.
snmpEnabled - Sets the SNMP Status Enabled option. Value of 1 is checked, value of 0 is unchecked.
snmpDevIndex - Set the SNMP Device Index option. Default value is 1.
RUNONCE - Signifies if the GPP should be set to Apply once and do not reapply. Valid values are YES or NO.
SUBEND - Internal script header to indicate XML subnode ending.
Printer GPP Example
See Deployment for instructions on updating GPP.
$XMLItemValues += @($LocalPrinterCLSID,"1","Fax","","3",$DateUni,$GUID,"1","Created By $FirmName on $Date. Removes the Send to Fax Printer.","0","PRIMARYEND","D","Fax","","","0","0","","","Yes","SUBEND")
This line deletes the built in Fax printer.
