Skip to content

Commit

Permalink
reformatting About_* for 80 columns - part 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Wheeler authored and zjalexander committed Dec 5, 2017
1 parent 66349ff commit 6424e0d
Show file tree
Hide file tree
Showing 25 changed files with 3,466 additions and 2,940 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
ms.date: 2017-06-09
ms.date: 2017-12-01
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
title: about_Remote_Output
---

# About Remote Output
## about_Remote_Output


# SHORT DESCRIPTION

Expand All @@ -25,7 +23,6 @@ of commands that are run on remote computers.

# DISPLAYING THE COMPUTER NAME


When you use the Invoke-Command cmdlet to run a command on a remote
computer, the command returns an object that includes the name of
the computer that generated the data. The remote computer name is
Expand All @@ -37,12 +34,14 @@ remote computers, Server01 and Server02. The output, which appears
below, includes the names of the remote computers on which the command
ran.

```powershell
C:\PS> invoke-command -script {get-culture} -comp Server01, Server02
LCID Name DisplayName PSComputerName
---- ---- ----------- --------------
1033 en-US English (United States) Server01
1033 es-AR Spanish (Argentina) Server02
```

You can use the HideComputerName parameter of Invoke-Command to hide
the PSComputerName property. This parameter is designed for commands
Expand All @@ -52,29 +51,32 @@ The following command runs a Get-Culture command on the Server01
remote computer. It uses the HideComputerName parameter to hide the
PSComputerName property and related properties.

```powershell
C:\PS> invoke-command -scr {get-culture} -comp Server01 -HideComputerName
LCID Name DisplayName
---- ---- -----------
1033 en-US English (United States)
```

You can also display the PSComputerName property if it is not displayed
by default.

For example, the following commands use the Format-Table cmdlet to add
the PSComputerName property to the output of a remote Get-Date command.

C:\PS> $dates = invoke-command -script {get-date} -computername Server01, Server02
C:\PS> $dates | format-table DateTime, PSComputerName -auto
```powershell
$dates = invoke-command -script {get-date} -computername Server01, Server02
$dates | format-table DateTime, PSComputerName -auto
DateTime PSComputerName
-------- --------------
Monday, July 21, 2008 7:16:58 PM Server01
Monday, July 21, 2008 7:16:58 PM Server02
```

# DISPLAYING THE MACHINENAME PROPERTY


Several cmdlets, including Get-Process, Get-Service, and Get-EventLog,
have a ComputerName parameter that gets the objects on a remote computer.
These cmdlets do not use Windows PowerShell remoting, so you can use them
Expand All @@ -89,13 +91,15 @@ For example, this command gets the PowerShell process on the Server01 and
Server02 remote computers. The default display does not include the
MachineName property.

```powershell
C:\PS> get-process PowerShell -computername server01, server02
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
920 38 97524 114504 575 9.66 2648 PowerShell
194 6 24256 32384 142 3020 PowerShell
352 27 63472 63520 577 3.84 4796 PowerShell
```

You can use the Format-Table cmdlet to display the MachineName property
of the process objects.
Expand All @@ -105,6 +109,7 @@ and then uses a pipeline operator (|) to send the processes in $p to the
Format-Table command. The command uses the Property parameter of
Format-Table to include the MachineName property in the display.

```powershell
C:\PS> $p = get-process PowerShell -comp Server01, Server02
C:\PS> $P | format-table -property ID, ProcessName, MachineName -auto
Expand All @@ -113,13 +118,15 @@ Id ProcessName MachineName
2648 PowerShell Server02
3020 PowerShell Server01
4796 PowerShell Server02
```

The following more complex command adds the MachineName property to the
default process display. It uses hash tables to specify calculated
properties. Fortunately, you do not have to understand it to use it.

(Note that the backtick [`] is the continuation character.)

```powershell
C:\PS> $p = get-process PowerShell -comp Server01, Server02
C:\PS> $p | format-table -property Handles, `
Expand All @@ -136,6 +143,8 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName MachineName
192 6 24132 32028 140 3020 PowerShell Server01
438 26 48436 59132 565 4796 PowerShell Server02
```

# DESERIALIZED OBJECTS

When you run remote commands that generate output, the command output is
Expand Down Expand Up @@ -198,19 +207,18 @@ computers are interspersed.

[about_Remote_Variables](about_Remote_Variables.md)

Format-Table

Get-EventLog
[Format-Table](../../Microsoft.PowerShell.Utility/Format-Table.md)

Get-Process
[Get-EventLog](../../Microsoft.PowerShell.Management/Get-EventLog.md)

Get-Service
[Get-Process](../../Microsoft.PowerShell.Management/Get-Process.md)

Get-WmiObject
[Get-Service](../../Microsoft.PowerShell.Management/Get-Service.md)

Invoke-Command
[Get-WmiObject](../../Microsoft.PowerShell.Management/Get-WmiObject.md)

Out-GridView
[Invoke-Command](../Invoke-Command.md)

Select-Object
[Out-GridView](../../Microsoft.PowerShell.Utility/Out-GridView.md)

[Select-Object](../../Microsoft.PowerShell.Utility/Select-Object.md)
Loading

0 comments on commit 6424e0d

Please sign in to comment.