Tip: Getting legacy printer names back in XenApp 7.5

Hello Folks,

i got some questions regarding the use of legacy printer names in XenApp 7.5. In XenApp/XenDesktop 7.5 the legacy printer name policy is not available any more. This is really bad for a couple of applications which needs to get the old Printer name convention.

After doing a small research i found a working solution in the Citrix Forums, after the Login was done and the Printers are mapped you need to run a small powershell script:

$SessionID=((qwinsta /server:$ServerName | foreach { (($_.trim() -replace “\s+”,”,”))} | ConvertFrom-Csv)|Where-Object {$_.SESSIONNAME.StartsWith(">")}).id
$MyPrinters=Get-WmiObject -Class Win32_Printer -Filter "PortName like 'Client:$SessionID%'" -Property PortName,DeviceID
$MyPrinters|% {$_.RenamePrinter("Client/$env:clientname#/"+$_.PortName.Split(':')[2])}>$null

Save this code in a powershell script and execute it as last command in a logon script.

Of course you can modify it if required but please note: This comes without any support or warranty!

Cheers
Michael