Open navigation

Add-TpmsSharingInfo

Description

Syntax

Example 1: cmdlet usage

Example 2: Script containing Add-TpmsSharingInfo



Description

Adds sharing properties to a printer object and specifies whether it is to be listed in the Active Directory.

With V-Layers the sharing properties must be set for both the native and the Output Gateway printer objects separately.

Note! Always run Add-TpmsSharingInfo together with New-TpmsObjPrinter or New-TpmsObjPrinterTpog – i. e., not with separate scripts.


Syntax

Add-TpmsSharingInfo -Printers <PSObject[]> -Name <string> -Mode <string> 
ParameterDescription
-Printersprinters to be shared
-Nameshare names
-Mode

specifies whether a printer is to be shared and/or listed in the Active Directory

ActiveDirectory: share printer and list it in the AD

Network: share printer only

Note! This Tpms version supports only share names of up to 32 characters. If you need longer share names, please contact our support for a fix:
thinprint.com/en/resources-support/support-request 


Example 1: cmdlet usage

Add-TpmsSharingInfo -Printers ($printer) -Name TpmsSharing01 -Mode ActiveDirectory 
$printer = $printer | Add-TpmsSharingInfo -Name TpmsSharing01 -Mode Network

Both lines add sharing settings to the printers specified in the $printer variable.

On this, see also New-TpmsObjPrinterTpog.


Example 2: Script containing Add-TpmsSharingInfo

The following script creates ten printers with Standard TCP/IP Ports which are defined in a .csv file. The print­ers are shared in the network but not listed in the Active Directory (-Mode Network). The printer name is used also as share name.

  • The definition file network-printers.csv:
"Selected","PrinterName","PortName","Address","DriverName","TemplateName" 
"1","PRN01-BLN","PRN01-BLN:","192.168.209.203","Lexmark T644 (MS)","Lexmark T644" 
"1","PRN02-PRS","PRN02-PRS:","192.168.149.125","Kyocera FS-C8500DN","Kyocera FS-C8500DN" 
"1","PRN03-WRS","PRN03-WRS:","192.168.149.127","Canon LBP7660C Class Driver","Canon LBP7660C" 
"1","PRN04-PRG","PRN04-PRG:","192.168.149.126","Brother PCL6 Class Driver","Brother" 
"1","PRN05-MSC","PRN05-MSC:","192.168.149.120","Xerox Phaser 6300N","Xerox Phaser 6300N" 
"1","PRN06-LDN","PRN06-LDN:","192.168.149.124","Dell B1265dnf Laser MFP PCL6","Dell B1265dnf Laser MFP" 
"1","PRN07-OSL","PRN07-OSL:","192.168.149.129","HP Color LaserJet 9500 PCL6 Class Driver","HP Color LaserJet 9500" 
"1","PRN08-STK","PRN08-STK:","192.168.149.123","KONICA MINOLTA PS Color Laser Class Driver","KONICA MINOLTA PS Color Laser" 
"1","PRN09-KPN","PRN09-KPN:","192.168.149.128","OKI PCL6 Class Driver","OKI" 
"1","PRN10-BPT","PRN10-BPT:","192.168.149.122","Samsung ML-4555 Series PCL6","Samsung ML-4555"
  • The PowerShell script:
$allports = @() 
$allprinters = @() 
Import-Csv -Path .\network-printers.csv | foreach { 
if($_.Selected -eq 1) 
{ 
$port = New-TpmsObjTcpIpPortRaw -Name $_.PortName -PortNumber 9100 -HostAddress $_.Address 
$printer = New-TpmsObjPrinter -Name $_.PrinterName -Driver $_.DriverName -Port $_.PortName -Template $_.TemplateName 
Add-TpmsSharingInfo -Printers ($printer) -Name $_.PrinterName -Mode Network 
} 
$allports += $port 
$allprinters += $printer 
} 
$srva = New-TpmsObjApplyAgent -Name "cps47.ourdomain.local" -Port 5050 -Printers ($allprinters) -Ports ($allports) 
Start-TpmsApplyByAgent -Action Deploy -Servers ($srva) | Format-TpmsDispatch


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.