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

Related Posts

While using the ShareFile mobile applications, NTF... Here's a weird little bug I caught in the wild while deploying XenMobile Enterprise. While browsing NTFS shares, published as connectors in the ShareF...
UnSticking an AppDisk provisioning task in XenDesk... Here's a wee little bug I've no idea how i created, but managed to clear it out anyway. After creating an AppDisk, it got a little stuck. I tried d...
Cannot Log into XenMobile 10.3 Appliance after ini... Here's a horrendous bug I just came across in the field today while deploying a XenMobile 10.3 Proof...

One Comment About “Update: Powershell script to check XenApp replicated print drivers

Leave a Reply