Home > Citrix, PowerShell Scripting, XenApp > Compare Print drivers in your XenApp environment to the Auto replication list

Compare Print drivers in your XenApp environment to the Auto replication list

Just a quick powershell script to check the auto replicated print driver list and ensure all your xenapp servers hold the driver.

This script is really handy for post server installations to ensure all print drivers are available on all servers before bringing the servers into production. You could modify it quite simply to send an email or run as a scheduled task.

This script requires the powershell XenApp snappins.

clear
#Checking for installed snapins and installing citrix if needed
 foreach ($entry in get-pssnapin | select-string -pattern “citrix.xenapp.commands”){
$found=1}
if ($found -eq 1){
}
else {
write-host “Adding Citrix Snapin’s, Please wait:”
Add-PSSnapin Citrix*
}

Write-host “getting up to date printer info from IMA, Please wait:”
update-xaprinter
sleep 15

$autorepllist = @()
$autorepldriver = get-xaautoreplicatedprinterdriver | sort
foreach ($driver in $autorepldriver){$autorepllist += $driver.drivername}
$servers = Get-XAServer

foreach($server in $servers){
$serverlist = @()
$serverdriverlist = get-xaprinterdriver -server $server | sort
echo “checking $server”
foreach ($driver in $serverdriverlist){$serverlist += $driver.drivername}
foreach ($driver in $autorepllist){
    if ($serverlist -notcontains $driver)
    {echo “******** $driver missing from $server”}
    Else
    {}
}
}
write-host “Process complete, check above for errors”

read-host ‘Press any key to continue . . .’ | out-null

The output looks as follows:

  1. verdural
    February 14, 2013 at 10:11 am

    Hi Andre,
    Could you please write the same powershell script to compare the installed Printer drivers on Remote Desktop Servers.
    Thanks in advance.

    • February 15, 2013 at 2:38 pm

      Hi, I won’t write it for you, but if you send me an email ill help you write it.

      What are you going to use as a comparison?

      • Omar ESA
        February 18, 2013 at 2:02 pm

        Hi Andrew, Ik wrote a powershell script that report all Installed printer drivers on alle Terminal Servers (see attached zipped scripts), but i would like to write an other script which compare the driver’s version of each terminal Server (Like your script on XenApp).If a printer driver is missing on a Terminal Server, it will be reported (example: the Kyocera KM-3050 KM v5.2.1326.0 is not installed on Terminal Server 33). Thanks in advance, Kind regards,Verdural Date: Fri, 15 Feb 2013 14:38:27 +0000 To: verdural@hotmail.com

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: