Get-CitrixPrinterInfo.ps1 (Citrix Top 10)
This script just collects the Printer Information from all the Servers in the Farm. It will output them to a file or you can pipe them and filter them.
Name: Get-CitrixPrinterInfo.ps1
Purpose: Gets Print Driver Info from all the Servers in the Farm and outputs to file or console
-
# Get-CitrixPrinterInfo.ps1
-
# Brandon Shell [MVP]
-
# www.bsonposh.com
-
# Gets Print Driver Info from all the Servers in the Farm
-
Param($Server,$file,[Switch]$help)
-
function HelpMe{
-
Write-Host
-
Write-Host " Get-CitrixPrinterInfo.ps1:" -fore Green
-
Write-Host " Gets Print Driver Info from all the Servers in the Farm"
-
Write-Host
-
Write-Host " Parameters:" -fore Green
-
Write-Host " -Server : Optional. Server to Get Print Info From "
-
Write-Host " -File : Optional. File Name to Export Info to"
-
Write-Host " -Help : Optional. Displays This"
-
Write-Host
-
Write-Host " Examples:" -fore Green
-
Write-Host " Gets Print Info and Exports to File" -fore White
-
Write-Host " .\Get-CitrixPrinterInfo.ps1 -file MyExportFile.txt" -fore Yellow
-
Write-Host
-
Write-Host " Gets Print Drivers from a Specific Server and outputs DriverName and SourceServer" -fore White
-
Write-Host " .\Get-CitrixPrinterInfo.ps1 <serverName> | ft DriverName,SourceServer" -fore Yellow
-
Write-Host
-
}
-
-
# Check for Help Flag
-
if($help){HelpMe;Write-Host;Return}
-
-
# Check for File
-
if($file)
-
{
-
if($server) # If -Server was passed we run check just against it and output to screen
-
{
-
$mfsrv = new-Object -com "MetaframeCOM.MetaframeServer"
-
$mfsrv.Initialize(6,$Server.ToUpper())
-
$mfsrv | foreach{"`n$($_.ServerName) `n$(’-'*20)";$_.PrinterDrivers| Format-Table} | out-File $file -enc ASCII
-
}
-
else # We run the check against the whole farm and output results to file
-
{
-
$mfarm = new-Object -com "MetaframeCOM.MetaframeFarm"
-
$mfarm.Initialize(1)
-
$mfarm.Servers | foreach{"`n$($_.ServerName) `n$(’-'*20)";$_.PrinterDrivers| Format-Table} | out-File $file -enc ASCII
-
}
-
}
-
else
-
{
-
if($server) # If -Server was passed we run check just against it and output to screen
-
{
-
$mfsrv = new-Object -com "MetaframeCOM.MetaframeServer"
-
$mfsrv.Initialize(6,$Server.ToUpper())
-
$mfsrv | foreach{"`n$($_.ServerName) `n$(’-'*20)";$_.PrinterDrivers| Format-Table}
-
}
-
else # We run the check against the whole farm and output results to screen
-
{
-
$mfarm = new-Object -com "MetaframeCOM.MetaframeFarm"
-
$mfarm.Initialize(1)
-
$mfarm.Servers | foreach{"`n$($_.ServerName) `n$(’-'*20)";$_.PrinterDrivers| Format-Table}
-
}
-
}
tshell :: Apr.07.2008 :: Citrix, Powershell, Scripting :: No Comments »
