Out-Printer - Powershell 1.0 CmdLet
ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »
Out-Printer
Description
Send the output to a printer
Usage
Options
Example(s)
Print a text file:
PS C:\>get-content $pshome\about_signing.help.txt | Out-Printer
Print "Hello, World" to a specific printer:
PS C:\>"Hello, World" | out-printer "\\Server64\Prn86754"
Send the content of a variable to the default printer:
PS C:\> $myhelp = get-help -detailed get-wmiobject
out-printer -inputobject $myhelp
Cancel print Jobs:
PS C:\>Get-WmiObject Win32_Printer -computerName "Server64" | Where {$_.Name -eq "My Printer"} | ForEach { $_.CancelAllJobs() }
Print a file from Microsoft Word (which can apply formatting changes)
$WordObj=New-Object -ComObject Word.Application
$WordObj.Documents.Add('C:\test.txt') > $null
$WordObj.ActiveDocument.Content.Font.Size = 12
$WordObj.ActiveDocument.Content.Font.Name = "Verdana"
#Send To Default Printer
$WordObj.PrintOut()
#Close File without saving
$WordObj.ActiveDocument.Close(0)
$WordObj.quit()
