Out-Printer
Additional Resources for Out-Printer |
Printing Returned Data http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/out-printer.mspx
|
SYNOPSIS
Sends output to a printer.
SYNTAX
Out-Printer [[-name] <string>] [-inputObject <psobject>] [<CommonParameters>]
DETAILED DESCRIPTION
The Out-Printer cmdlet sends output to the default printer or to an alternate printer, if one is specified.
PARAMETERS
-name <string>
Specifies the alternate printer. The parameter name ("-Name") is optional.
Required? |
false |
Position? |
1 |
Default value |
Default printer |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-inputObject <psobject>
Specifies the objects to be sent to the printer. Enter a variable that contains the objects or type a command or expression that gets the objects.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
true (ByValue) |
Accept wildcard characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE
None
RETURN TYPE
None
NOTES
For more information, type "Get-Help Out-Printer -detailed". For technical information, type "Get-Help Out-Printer -full".
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
You can also refer to Out-Printer by its built-in alias, "lp". For more information, see About_Alias.
The Out cmdlets do not format objects; they just render them and send them to the specified display destination. If you send an unformatted object to an Out cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.
The Out cmdlets do not have parameters for names or file paths. To send data to an Out cmdlets, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a variable and use the InputObject parameter to pass the data to the cmdlet. For help, see the examples.
Out-Printer sends data, but it does not emit any output objects. If you pipe the output of Out-Printer to Get-Member, Get-Member reports that no objects have been specified.
EXAMPLE 1
get-content $pshome\about_signing.help.txt | Out-Printer
This command prints the content of the About_Signing help file to the default printer. This example shows you how to print a file, even though Out-Printer does not have a Path parameter.
The command uses the Get-Contentcmdlet to get the contents of the help file. The path includes $pshome, a built-in variable that stores the installation directory for Windows PowerShell. A pipeline operator (|) passes the results to Out-Printer, which sends it to the default printer.
EXAMPLE 2
"Hello, World" | out-printer -name "\\Server01\Prt-6B Color"
This command prints "Hello, World" to the "Prt-6B Color" printer on Server01. This command uses the Name parameter to specify the alternate printer. Because the parameter name is optional, you can omit it.
EXAMPLE 3
$h = get-help -full get-wmiobject
out-printer -inputobject $h
These commands print the full version of the help for Get-WmiObject. The first command use the Get-Helpcmdlet to get the full version of the help for Get-WmiObject, and stores it in the $h variable. The second command sends the content to the default printer. It uses the InputObject parameter to pass the value of the $h variable to Out-Printer.
RELATED LINKS