Home > Citrix, PowerShell Scripting, XenApp > Update: Powershell script to check XenApp replicated print drivers

Update: Powershell script to check XenApp replicated print drivers

An old colleague of mine recently requested a copy of my print driver replication script, he wanted the script to add the XenApp module if needed, to only report if a driver was missing and he also wanted a progress report.

Not one to disappoint, The updated script now handles the adding of the citrix module itself and reports progress with a flashy progress bar:

It will only report an issue if a driver is missing from a server:

The script is below:

function check-replicatedprintdrivers{
    #Checking for installed snapins and installing citrix if needed
    if (!(get-pssnapin | select-string -pattern “citrix.xenapp.commands”)){write-warning "adding Citrix Snapin's, please wait:";Add-PSSnapin Citrix*}

    #finding correct command depending on version
    if ((get-xafarm | select serverversion) -like "*6.0*"){
	update-xaprinterdriver}
    Else {update-xaprinter}

   get-xaautoreplicatedprinterdriver | sort | foreach {$replicationlist += @($_.drivername)}

   $servers = get-xaserver
    foreach($server in $servers){
        $i++
            $percentcomplete=(($i / $servers.length) * 100)
    		Write-Progress -activity "Performing driver check:" -status "Currently working on: $server" -PercentComplete (($i / $servers.length) * 100)

        $serverlist = get-xaprinterdriver -server $server | sort | % {$_.drivername}

        foreach ($driver in $ReplicationList){
            if ($serverlist -notcontains $driver){
                $warning += @(“Driver: [$driver] is missing from $server”)
            }#endif

        }#end for each driver
    }#end for each server

Return $warning
}#end function
check-replicatedprintdrivers
  1. February 15, 2012 at 3:01 pm

    I had the same problem, made a nice GUI for it, get it free; http://www.gourami.eu/products/xenapp-printer-driver-manager

  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: