diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote.md index 6bf622ac5323..1644d5d78bd3 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote --- - # About Remote ## SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Disconnected_Sessions.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Disconnected_Sessions.md index 396c15a85728..4cfc0f3b7e74 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Disconnected_Sessions.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Disconnected_Sessions.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_Disconnected_Sessions --- - # About Remote Disconnected Sessions ## Short Description @@ -44,12 +43,12 @@ location. The following cmdlets support the Disconnected Sessions feature: -* `Connect-PSSession`: Connects to a disconnected PSSession -* `Disconnect-PSSession`: Disconnects a PSSession -* `Get-PSSession`: Gets PSSessions on the local computer or on remote computers -* `Receive-PSSession`: Gets the results of commands that ran in disconnected +- `Connect-PSSession`: Connects to a disconnected PSSession +- `Disconnect-PSSession`: Disconnects a PSSession +- `Get-PSSession`: Gets PSSessions on the local computer or on remote computers +- `Receive-PSSession`: Gets the results of commands that ran in disconnected sessions -* `Invoke-Command`: **InDisconnectedSession** parameter creates a PSSession and +- `Invoke-Command`: **InDisconnectedSession** parameter creates a PSSession and disconnects immediately ## How the Disconnected Sessions Feature Works @@ -113,7 +112,7 @@ The first command creates a session to the Server01 computer. The session resides on the Server01 computer. ```powershell -PS C:\> New-PSSession -ComputerName Server01 +PS> New-PSSession -ComputerName Server01 Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -124,7 +123,7 @@ To get the session, use the **ComputerName** parameter of `Get-PSSession` with a value of Server01. ```powershell -PS C:\> Get-PSSession -ComputerName Server01 +PS> Get-PSSession -ComputerName Server01 Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -137,8 +136,8 @@ maintained on the local computer. It does not get PSSessions on the Server01 computer, even if they were started on the local computer. ```powershell -PS C:\> Get-PSSession -ComputerName localhost -PS C:\> +PS> Get-PSSession -ComputerName localhost +PS> ``` To get sessions that were created in the current session, use the @@ -146,7 +145,7 @@ To get sessions that were created in the current session, use the that was created in the current session and connects to the Server01 computer. ```powershell -PS C:\> Get-PSSession +PS> Get-PSSession Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -164,7 +163,7 @@ Notice that the value of the State property is Disconnected and the Availability is None. ```powershell -PS C:\> Get-PSSession -ComputerName Server01 | Disconnect-PSSession +PS> Get-PSSession -ComputerName Server01 | Disconnect-PSSession Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -179,7 +178,7 @@ The following command runs a `Get-WinEvent` command in a disconnected session on the Server02 remote computer. ```powershell -PS C:\> Invoke-Command -ComputerName Server02 -InDisconnectedSession ` +PS> Invoke-Command -ComputerName Server02 -InDisconnectedSession ` -ScriptBlock { Get-WinEvent -LogName "Windows PowerShell" } Id Name ComputerName State ConfigurationName Availability @@ -207,7 +206,7 @@ The following command gets the sessions on the Server02 computer. The output includes two disconnected sessions, both of which are available. ```powershell -PS C:\> Get-PSSession -ComputerName Server02 +PS> Get-PSSession -ComputerName Server02 Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -219,7 +218,7 @@ The following command connects to Session2. The PSSession is now open and available. ```powershell -PS C:\> Connect-PSSession -ComputerName Server02 -Name Session2 +PS> Connect-PSSession -ComputerName Server02 -Name Session2 Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -250,7 +249,7 @@ command that ran in the Session3 session. The command uses the **OutTarget** parameter to get the results in a job. ```powershell -PS C:\> Receive-PSSession -ComputerName Server02 -Name Session3 ` +PS> Receive-PSSession -ComputerName Server02 -Name Session3 ` -OutTarget Job Id Name PSJobTypeName State HasMoreData Location @@ -261,7 +260,7 @@ Id Name PSJobTypeName State HasMoreData Location To get the results of the job, use the `Receive-Job` cmdlet. ```powershell -PS C:\> Get-Job | Receive-Job -Keep +PS> Get-Job | Receive-Job -Keep ProviderName: PowerShell @@ -299,21 +298,21 @@ reconnected. ```powershell # Session 1 -PS C:\> New-PSSession -ComputerName Server30 -Name Test +PS> New-PSSession -ComputerName Server30 -Name Test Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ 1 Test Server30 Opened Microsoft.PowerShell Available # Session 2 -PS C:\> Get-PSSession -ComputerName Server30 -Name Test +PS> Get-PSSession -ComputerName Server30 -Name Test Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ 1 Test Server30 Disconnected Microsoft.PowerShell Busy # Session 1 -PS C:\> Get-PSSession -ComputerName Server30 -Name Test | +PS> Get-PSSession -ComputerName Server30 -Name Test | >> Disconnect-PSSession Id Name ComputerName State ConfigurationName Availability @@ -321,21 +320,19 @@ Id Name ComputerName State ConfigurationName Availability 1 Test Server30 Disconnected Microsoft.PowerShell None # Session 2 -PS C:\> Get-PSSession -ComputerName Server30 +PS> Get-PSSession -ComputerName Server30 Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ 1 Test Server30 Disconnected Microsoft.PowerShell None # Session 2 -PS C:\> Connect-PSSession -ComputerName Server01 -Name Test +PS> Connect-PSSession -ComputerName Server01 -Name Test Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ -3 Test Server30 Opened Microsoft.PowerShell Available - -# Session 1 -PS C:\> Get-PSSession -ComputerName Server30 +3 Test Server30 Opened Microsoft.PowerShell Available# Session 1 +PS> Get-PSSession -ComputerName Server30 Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ @@ -398,7 +395,7 @@ in SessionOption object and the IdleTimeout value in the $PSSessionOption preference variable do not change the value of the IdleTimeout of the PSSession in a `Connect-PSSession` or `Receive-PSSession` command. -* To create a PSSession with a particular idle timeout value, create +- To create a PSSession with a particular idle timeout value, create a $PSSessionOption preference variable. Set the value of the IdleTimeout property to the desired value (in milliseconds). @@ -411,7 +408,7 @@ PSSession in a `Connect-PSSession` or `Receive-PSSession` command. $PSSessionOption = New-PSSessionOption -IdleTimeoutMSec 172800000 ``` -* To create a PSSession with a particular idle timeout value, use +- To create a PSSession with a particular idle timeout value, use the **IdleTimeoutMSec** parameter of the `New-PSSessionOption` cmdlet. Then, use the session option in the value of the **SessionOption** parameter of the `New-PSSession` or `Invoke-Command` cmdlets. @@ -427,7 +424,7 @@ $o = New-PSSessionOption -IdleTimeoutMSec 172800000 New-PSSession -SessionOption $o ``` -* To change a the idle timeout of a PSSession when disconnecting, +- To change a the idle timeout of a PSSession when disconnecting, use the **IdleTimeoutSec** parameter of the `Disconnect-PSSession` cmdlet. @@ -437,7 +434,7 @@ New-PSSession -SessionOption $o Disconnect-PSSession -IdleTimeoutSec 172800 ``` -* To create a session configuration with a particular idle timeout +- To create a session configuration with a particular idle timeout and maximum idle timeout, use the **IdleTimeoutSec** and **MaxIdleTimeoutSec** parameters of the `New-PSTransportOption` cmdlet. Then, use the transport option in the value of the **TransportOption** parameter @@ -450,7 +447,7 @@ $o = New-PSTransportOption -IdleTimeoutSec 172800 -MaxIdleTimeoutSec 259200 Register-PSSessionConfiguration -Name Test -TransportOption $o ``` -* To change the default idle timeout and maximum idle timeout of +- To change the default idle timeout and maximum idle timeout of a session configuration, use the **IdleTimeoutSec** and **MaxIdleTimeoutSec** parameters of the `New-PSTransportOption` cmdlet. Then, use the transport option in the value of the **TransportOption** parameter @@ -473,12 +470,12 @@ whether the command continues to run while the session is disconnected. Valid values: -* Block +- Block When the output buffer is full, execution is suspended until the buffer is clear. -* Drop +- Drop When the output buffer is full, execution continues. As new output is generated, the oldest output is discarded. @@ -513,7 +510,7 @@ If you are a member of the Administrators group on the remote computer, you can also create and change the output buffering mode of session configurations. -* To create a PSSession with an output buffering mode of Drop, create +- To create a PSSession with an output buffering mode of Drop, create a $PSSessionOption preference variable in which the value of the OutputBufferingMode property is Drop. @@ -526,7 +523,7 @@ configurations. $PSSessionOption = New-PSSessionOption -OutputBufferingMode Drop ``` -* To create a PSSession with an output buffering mode of Drop, use +- To create a PSSession with an output buffering mode of Drop, use the **OutputBufferingMode** parameter of the `New-PSSessionOption` cmdlet to create a session option with a value of Drop. Then, use the session option in the value of the **SessionOption** parameter of @@ -543,7 +540,7 @@ $o = New-PSSessionOption -OutputBufferingMode Drop New-PSSession -SessionOption $o ``` -* To change a the output buffering mode of a PSSession when +- To change a the output buffering mode of a PSSession when disconnecting, use the **OutputBufferingMode** parameter of the `Disconnect-PSSession` cmdlet. @@ -553,7 +550,7 @@ New-PSSession -SessionOption $o Disconnect-PSSession -OutputBufferingMode Drop ``` -* To change a the output buffering mode of a PSSession when +- To change a the output buffering mode of a PSSession when reconnecting, use the **OutputBufferingMode** parameter of the `New-PSSessionOption` cmdlet to create a session option with a value of Drop. Then, use the session option in the value of the @@ -563,10 +560,10 @@ Disconnect-PSSession -OutputBufferingMode Drop ```powershell $o = New-PSSessionOption -OutputBufferingMode Drop -Connect-PSSession -Cn Server01 -Name Test -SessionOption $o +Connect-PSSession -ComputerName Server01 -Name Test -SessionOption $o ``` -* To create a session configuration with a default output buffering +- To create a session configuration with a default output buffering mode of Drop, use the **OutputBufferingMode** parameter of the `New-PSTransportOption` cmdlet to create a transport option object with a value of Drop. Then, use the transport option in the value of @@ -579,7 +576,7 @@ $o = New-PSTransportOption -OutputBufferingMode Drop Register-PSSessionConfiguration -Name Test -TransportOption $o ``` -* To change the default output buffering mode of a session +- To change the default output buffering mode of a session configuration, use the **OutputBufferingMode** parameter of the `New-PSTransportOption` cmdlet to create a transport option with a value of Drop. Then, use the Transport option in the value of the diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_FAQ.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_FAQ.md index dd14949a0e16..e140b759fa74 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_FAQ.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_FAQ.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_FAQ --- - # About Remote FAQ ## SHORT DESCRIPTION @@ -53,7 +52,7 @@ session on the local computer. To transmit the commands and receive the output, Windows PowerShell uses the WS-Management protocol. For information about the WS-Management protocol, see -[WS-Management Protocol](http://go.microsoft.com\/fwlink/?LinkId=144634) in +[WS-Management Protocol](http://go.microsoft.com/fwlink/?LinkId=144634) in the MSDN library. Beginning in Windows PowerShell 3.0, remote sessions are stored on the remote @@ -468,7 +467,8 @@ changes. You can use the following Windows PowerShell command to add this entry: - ```powershell + +```powershell $parameters = @{ Path='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' Name='LocalAccountTokenFilterPolicy' diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Jobs.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Jobs.md index 36f61eac5bfe..808c1008fd5c 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Jobs.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Jobs.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_Jobs --- - # About Remote Jobs ## SHORT DESCRIPTION @@ -65,7 +64,7 @@ session (PSSession). The following command starts an interactive session on the Server01 computer. ```powershell -C:\PS> Enter-PSSession -computername Server01 +PS> Enter-PSSession -computername Server01 ``` The command prompt changes to show that you are now connected to the Server01 @@ -87,7 +86,7 @@ This command saves the job object in the \$job variable. ```powershell Server01\C:> $job = start-job -scriptblock { - get-eventlog "Windows PowerShell" + Get-EventLog "Windows PowerShell" } ``` @@ -134,7 +133,7 @@ computer. ```powershell Server01\C:> Exit-PSSession -C:\PS> +PS> ``` #### STEP 6: INVOKE-COMMAND: GET-CONTENT @@ -151,9 +150,9 @@ to run a Get-Content command in the PSSession to view the contents of the file. ```powershell -$s = new-pssession -computername Server01 -invoke-command -session $s -scriptblock { - get-content c:\logs\pslog.txt} +$s = New-PSSession -ComputerName Server01 +Invoke-Command -Session $s -ScriptBlock { + Get-Content c:\logs\pslog.txt} ``` ### START A REMOTE JOB THAT RETURNS THE RESULTS TO THE LOCAL COMPUTER \(ASJOB\) @@ -180,8 +179,8 @@ that gets the events in the System log. You can use the JobName parameter to assign a display name to the job. ```powershell -invoke-command -computername Server01 -scriptblock { - get-eventlog system} -asjob +Invoke-Command -ComputerName Server01 -ScriptBlock { + Get-EventLog system} -asjob ``` The results of the command resemble the following sample output. @@ -210,7 +209,7 @@ To determine whether the job is complete, use a Get-Job command. The following command gets all of the jobs that were started in the current session. ```powershell -get-job +Get-Job ``` Because the remote job was started in the current session, a local Get-Job @@ -234,7 +233,7 @@ job. It uses the session ID to identify the job. This command saves the job results in the $results variable. You can also redirect the results to a file. ```powershell -$results = receive-job -id 1 +$results = Receive-Job -Id 1 ``` ### START A REMOTE JOB THAT KEEPS THE RESULTS ON THE REMOTE COMPUTER @@ -264,7 +263,7 @@ is connected to the Server01 computer. The command saves the PSSession in the \$s variable. ```powershell -$s = new-pssession -computername Server01 +$s = New-PSSession -ComputerName Server01 ``` The next command uses the Invoke-Command cmdlet to run a Start-Job command in @@ -272,8 +271,8 @@ the PSSession. The Start-Job command and the Get-Eventlog command are enclosed in braces. ```powershell -invoke-command -session $s -scriptblock { - start-job -scriptblock {get-eventlog system}} +Invoke-Command -Session $s -ScriptBlock { + Start-Job -ScriptBlock {Get-EventLog system}} ``` The results resemble the following sample output. @@ -303,7 +302,7 @@ To see if the job is complete, use an Invoke-Command command to run a Get-Job command in the PSSession that is connected to the Server01 computer. ```powershell -invoke-command -session $s -scriptblock {get-job} +Invoke-Command -Session $s -ScriptBlock {Get-Job} ``` The command returns a job object. The State property of the job object shows @@ -327,8 +326,8 @@ results in the \$results variable. It uses the Keep parameter of Receive-Job to keep the result in the job cache on the remote computer. ```powershell -$results = invoke-command -session $s -scriptblock { - receive-job -sessionid 2 -keep} +$results = Invoke-Command -Session $s -ScriptBlock { + Receive-Job -sessionid 2 -keep} ``` You can also redirect the results to a file on the local or remote computer. @@ -336,8 +335,8 @@ The following command uses a redirection operator to save the results in a file on the Server01 computer. ```powershell -invoke-command -session $s -command { - receive-job -sessionid 2 > c:\logs\pslog.txt} +Invoke-Command -Session $s -ScriptBlock { + Receive-Job -sessionid 2 > c:\logs\pslog.txt} ``` ## SEE ALSO diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Output.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Output.md index 0d11ff6ea68d..331fec4403bf 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Output.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Output.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_Output --- - # About Remote Output # SHORT DESCRIPTION @@ -35,7 +34,7 @@ below, includes the names of the remote computers on which the command ran. ```powershell -C:\PS> invoke-command -script {get-culture} -comp Server01, Server02 +PS> invoke-command -script {Get-Culture} -comp Server01, Server02 LCID Name DisplayName PSComputerName ---- ---- ----------- -------------- @@ -52,7 +51,7 @@ 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 +PS> invoke-command -scr {Get-Culture} -comp Server01 -HideComputerName LCID Name DisplayName ---- ---- ----------- @@ -66,9 +65,8 @@ For example, the following commands use the Format-Table cmdlet to add the PSComputerName property to the output of a remote Get-Date command. ```powershell -$dates = invoke-command -script {get-date} -computername Server01, Server02 -$dates | format-table DateTime, PSComputerName -auto - +$dates = Invoke-Command -ScriptBlock {Get-Date} -ComputerName Server01, Server02 +$dates | Format-Table DateTime, PSComputerName -AutoSize DateTime PSComputerName -------- -------------- Monday, July 21, 2008 7:16:58 PM Server01 @@ -92,7 +90,7 @@ Server02 remote computers. The default display does not include the MachineName property. ```powershell -C:\PS> get-process PowerShell -computername server01, server02 +PS> get-process PowerShell -computername server01, server02 Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- @@ -110,9 +108,8 @@ 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 - +PS> $p = get-process PowerShell -comp Server01, Server02 +PS> $P | Format-Table -Property ID, ProcessName, MachineName -AutoSize Id ProcessName MachineName -- ----------- ----------- 2648 PowerShell Server02 @@ -127,16 +124,15 @@ 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 +PS> $p = get-process PowerShell -comp Server01, Server02 -C:\PS> $p | format-table -property Handles, ` +PS> $p | Format-Table -Property Handles, ` @{Label="NPM(K)";Expression={int}}, ` @{Label="PM(K)";Expression={int}}, ` @{Label="WS(K)";Expression={int}}, ` @{Label="VM(M)";Expression={int}}, ` @{Label="CPU(s)";Expression={if ($.CPU -ne $()){ $.CPU.ToString("N")}}}, ` -Id, ProcessName, MachineName -auto - +Id, ProcessName, MachineName -AutoSize Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName MachineName ------- ------ ----- ----- ----- ------ -- ----------- ----------- 920 38 97560 114532 576 2648 PowerShell Server02 diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Requirements.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Requirements.md index 07d053a421a9..1511809979b8 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Requirements.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Requirements.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_Requirements --- - # About Remote Requirements ## SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md index 38c89c13fe51..b77c6beedb70 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_Troubleshooting --- - # About Remote Troubleshooting ## SHORT DESCRIPTION @@ -220,8 +219,8 @@ Servers.txt file and then sets the startup type of the WinRM service on all of the computers to Automatic. ```powershell -C:\PS> $servers = Get-Content servers.txt -C:\PS> Set-Service WinRM -ComputerName $servers -startuptype Automatic +PS> $servers = Get-Content servers.txt +PS> Set-Service WinRM -ComputerName $servers -startuptype Automatic ``` To see the results use the Get-WMIObject cmdlet with the Win32_Service object. @@ -339,7 +338,7 @@ To change the policy, use the following command to set the value of the LocalAccountTokenFilterPolicy registry entry to 1. ```powershell -C:\PS> New-ItemProperty -Name LocalAccountTokenFilterPolicy -Path ` +PS> New-ItemProperty -Name LocalAccountTokenFilterPolicy -Path ` HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System ` -PropertyType DWord -Value 1 ``` @@ -555,10 +554,10 @@ For example, the following command creates a session option object with proxy session options and then uses the object to create a remote session. ```powershell -C:\PS> $SessionOption = New-PSSessionOption -ProxyAccessType IEConfig ` +PS> $SessionOption = New-PSSessionOption -ProxyAccessType IEConfig ` -ProxyAuthentication Negotiate -ProxyCredential Domain01\User01 -C:\PS> New-PSSession -ConnectionURI https://www.fabrikam.com +PS> New-PSSession -ConnectionURI https://www.fabrikam.com ``` For more information about the New-PSSessionOption cmdlet, see @@ -597,8 +596,8 @@ following command finds the processor architecture of the session in the \$s variable. ```powershell -$s = New-PSSession -ComputerName Server01 -configurationName CustomShell -invoke-command -session $s {$env:PROCESSOR_ARCHITECTURE} +$s = New-PSSession -ComputerName Server01 -ConfigurationName CustomShell +Invoke-Command -Session $s {$env:PROCESSOR_ARCHITECTURE} x86 ``` @@ -732,9 +731,9 @@ create a session option object with an OperationTimeout value of 4 minutes (in MS) and then use the session option object to create a remote session. ```powershell -C:\PS> $pso = New-PSSessionoption -OperationTimeout 240000 +PS> $pso = New-PSSessionoption -OperationTimeout 240000 -C:\PS> New-PSSession -ComputerName Server01 -sessionOption $pso +PS> New-PSSession -ComputerName Server01 -sessionOption $pso ``` For more information about the WS-Management timeouts, see the Help topic for diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Variables.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Variables.md index 45660395783e..cb22996109e9 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Variables.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Remote_Variables.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Remote_Variables --- - # About Remote Variables ## SHORT DESCRIPTION @@ -105,7 +104,7 @@ parameter name and the local variable, $ps, as its value. $ps = "Windows PowerShell" Invoke-Command -ComputerName S1 -ScriptBlock { param($log) - Get-WinEvent -logname $log + Get-WinEvent -LogName $log } -ArgumentList $ps ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Requires.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Requires.md index 8b17b445cbaf..d896ba8c7de7 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Requires.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Requires.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Requires --- - # About Requires ## SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Reserved_Words.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Reserved_Words.md index 46ba31199105..26c6b46d2913 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Reserved_Words.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Reserved_Words.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 06/09/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Reserved_Words --- - # About Reserved Words ## SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Return.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Return.md index 15fd437fe0a9..2ec83cbd52e3 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Return.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Return.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Return --- - # About Return ## SHORT DESCRIPTION @@ -102,7 +101,7 @@ The "Please wait. Working on calculation..." string is not displayed. Instead, it is assigned to the $a variable, as in the following example: ```output -C:\PS> $a +PS> $a Please wait. Working on calculation... 87 ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Run_With_PowerShell.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Run_With_PowerShell.md index db84fc679557..a0f94acd3f21 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Run_With_PowerShell.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Run_With_PowerShell.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Run_With_PowerShell --- - # About Run With PowerShell ## SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Blocks.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Blocks.md index 7d2d38616340..29de61703e3b 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Blocks.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Blocks.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 06/09/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Script_Blocks --- - # About Script Blocks ## SHORT DESCRIPTION @@ -55,7 +54,7 @@ block parameter values. For example, the `Invoke-Command` cmdlet has a example: ```powershell -PS C:\> Invoke-Command -ScriptBlock { Get-Process } +PS> Invoke-Command -ScriptBlock { Get-Process } Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- @@ -68,7 +67,7 @@ The script block that is used as a value can be more complicated, as shown in the following example: ```powershell -PS C:\> Invoke-Command -ScriptBlock { Param($uu = "Parameter"); +PS> Invoke-Command -ScriptBlock { Param($uu = "Parameter"); "$uu assigned." } Parameter assigned. ``` @@ -79,7 +78,7 @@ the **Args** parameter of the `Invoke-Command` cmdlet to assign a different value to the parameter: ```powershell -PS C:\> Invoke-Command -ScriptBlock { Param($uu = "Parameter"); +PS> Invoke-Command -ScriptBlock { Param($uu = "Parameter"); "$uu assigned."} -Args "Other value" Other value assigned. ``` @@ -95,7 +94,7 @@ You can use the variable with a cmdlet such as `Invoke-Command`, as shown in the following example: ```powershell -PS C:\> Invoke-Command -ScriptBlock $a -Args "Other value" +PS> Invoke-Command -ScriptBlock $a -Args "Other value" Other value assigned. ``` @@ -103,7 +102,7 @@ You can run a script block that is assigned to a variable by using the call operator (&), as shown in the following example: ```powershell -PS C:\> & $a +PS> & $a Parameter assigned. ``` @@ -111,7 +110,7 @@ You can also provide a parameter to the script block, as shown in the following example: ```powershell -PS C:\> & $a "Other value" +PS> & $a "Other value" Other value assigned. ``` @@ -120,8 +119,8 @@ variable, use the call operator to run the script block directly, as shown in the following example: ```powershell -PS C:\> $a = & { Param($uu = "Parameter"); "$uu assigned." } -PS C:\> $a +PS> $a = & { Param($uu = "Parameter"); "$uu assigned." } +PS> $a Parameter assigned. ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Internationalization.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Internationalization.md index 387fb3593652..24316977e109 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Internationalization.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Script_Internationalization.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Script_Internationalization --- - # About Script Internationalization ## Short Description @@ -30,24 +29,24 @@ tables to facilitate translation. To support international Help text, Windows PowerShell includes the following features: -* A Data section that separates text strings from code instructions. For more +- A Data section that separates text strings from code instructions. For more information about the Data section, see [aout_Data_Sections](about_Data_Sections.md). -* New automatic variables, \$PSCulture and \$PSUICulture. \$PSCulture stores the +- New automatic variables, \$PSCulture and \$PSUICulture. \$PSCulture stores the name of the UI language used on the system for elements such as the date, time, and currency. The $PSUICulture variable stores the name of the UI language used on the system for user interface elements such as menus and text strings. -* A cmdlet, `ConvertFrom-StringData`, that converts text strings into +- A cmdlet, `ConvertFrom-StringData`, that converts text strings into dictionary-like hash tables to facilitate translation. For more information, see [ConvertFrom-StringData](../../Microsoft.PowerShell.Utility/ConvertFrom-StringData.md). -* A new file type, .psd1, that stores translated text strings. The .psd1 files +- A new file type, .psd1, that stores translated text strings. The .psd1 files are stored in language-specific subdirectories of the script directory. -* A cmdlet, `Import-LocalizedData`, that imports translated text strings for a +- A cmdlet, `Import-LocalizedData`, that imports translated text strings for a specified language into a script at runtime. This cmdlet recognizes and imports strings in any Windows-supported language. For more information see [Import-LocalizedData](../../Microsoft.PowerShell.Utility/Import-LocalizedData.md). @@ -211,7 +210,7 @@ $a = $Day.d0, $Day.d1, $Day.d2, $Day.d3, $Day.d4, $Day.d5, $Day.d6 # Index into $a to get the name of the day. # Use string formatting to build a sentence. -"{0} {1}" -f $Day.messageDate, $a[(Get-Date -uformat %u)] | Out-Host +"{0} {1}" -f $Day.messageDate, $a[(Get-Date -UFormat %u)] | Out-Host ``` The .psd1 files that support the script are saved in subdirectories of @@ -242,9 +241,9 @@ Today is Friday (in German) ## See also -* [about_Data_Sections](about_Data_Sections.md) -* [about_Automatic_Variables](about_Automatic_Variables.md) -* [about_Hash_Tables](about_Hash_Tables.md) -* [about_Quoting_Rules](about_Quoting_Rules.md) -* [ConvertFrom-StringData](../../Microsoft.PowerShell.Utility/ConvertFrom-StringData.md) -* [Import-LocalizedData](../../Microsoft.PowerShell.Utility/Import-LocalizedData.md) \ No newline at end of file +- [about_Data_Sections](about_Data_Sections.md) +- [about_Automatic_Variables](about_Automatic_Variables.md) +- [about_Hash_Tables](about_Hash_Tables.md) +- [about_Quoting_Rules](about_Quoting_Rules.md) +- [ConvertFrom-StringData](../../Microsoft.PowerShell.Utility/ConvertFrom-StringData.md) +- [Import-LocalizedData](../../Microsoft.PowerShell.Utility/Import-LocalizedData.md) \ No newline at end of file diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Scripts.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Scripts.md index 50140030130b..c5f8fc04d517 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Scripts.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Scripts.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Scripts --- - # About Scripts ## SHORT DESCRIPTION @@ -133,7 +132,7 @@ path is in your Path environment variable, you can omit the path. For example, to get help for the ServicesLog.ps1 script, type: ```powershell -get-help C:\admin\scripts\ServicesLog.ps1 +Get-Help C:\admin\scripts\ServicesLog.ps1 ``` ### HOW TO WRITE A SCRIPT @@ -152,8 +151,8 @@ running on the current system and saves them to a log file. The log file name is created from the current date. ```powershell -$date = (get-date).dayofyear -get-service | out-file "$date.log" +$date = (Get-Date).dayofyear +Get-Service | Out-File "$date.log" ``` To create this script, open a text editor or a script editor, type these @@ -182,21 +181,21 @@ param ($ComputerName = $(throw "ComputerName parameter is required.")) function CanPing { $error.clear() - $tmp = test-connection $computername -erroraction SilentlyContinue + $tmp = Test-Connection $computername -ErrorAction SilentlyContinue if (!$?) - {write-host "Ping failed: $ComputerName."; return $false} + {Write-Host "Ping failed: $ComputerName."; return $false} else - {write-host "Ping succeeded: $ComputerName"; return $true} + {Write-Host "Ping succeeded: $ComputerName"; return $true} } function CanRemote { - $s = new-pssession $computername -erroraction SilentlyContinue + $s = New-PSSession $computername -ErrorAction SilentlyContinue if ($s -is [System.Management.Automation.Runspaces.PSSession]) - {write-host "Remote test succeeded: $ComputerName."} + {Write-Host "Remote test succeeded: $ComputerName."} else - {write-host "Remote test failed: $ComputerName."} + {Write-Host "Remote test failed: $ComputerName."} } if (CanPing $computername) {CanRemote $computername} @@ -205,7 +204,7 @@ if (CanPing $computername) {CanRemote $computername} To run this script, type the parameter name after the script name. For example: ```powershell -C:\PS> .\test-remote.ps1 -computername Server01 +PS> .\test-remote.ps1 -computername Server01 Ping succeeded: Server01 Remote test failed: Server01 @@ -281,12 +280,12 @@ and the $ProfileName variable. function New-Profile { Write-Host "Running New-Profile function" - $profileName = split-path $profile -leaf + $profileName = Split-Path $profile -leaf - if (test-path $profile) - {write-error "Profile $profileName already exists on this computer."} + if (Test-Path $profile) + {Write-Error "Profile $profileName already exists on this computer."} else - {new-item -type file -path $profile -force } + {New-Item -type file -Path $profile -Force } } ``` @@ -296,9 +295,9 @@ is running. When the script exits, the function and variable are removed, as shown in the following example. ```powershell -C:\PS> .\UtilityFunctions.ps1 +PS> .\UtilityFunctions.ps1 -C:\PS> New-Profile +PS> New-Profile The term 'new-profile' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. At line:1 char:12 @@ -306,8 +305,8 @@ At line:1 char:12 + CategoryInfo : ObjectNotFound: (new-profile:String) [], + FullyQualifiedErrorId : CommandNotFoundException -C:\PS> $profileName -C:\PS> +PS> $profileName +PS> ``` When you dot source the script and run it, the script creates the New-Profile @@ -316,9 +315,9 @@ the script runs, you can use the New-Profile function in your session, as shown in the following example. ```powershell -C:\PS> . .\UtilityFunctions.ps1 +PS> . .\UtilityFunctions.ps1 -C:\PS> New-Profile +PS> New-Profile Directory: C:\Users\juneb\Documents\WindowsPowerShell @@ -326,7 +325,7 @@ C:\PS> New-Profile ---- ------------- ------ ---- -a--- 1/14/2009 3:08 PM 0 Microsoft.PowerShellISE_profile.ps1 -C:\PS> $profileName +PS> $profileName Microsoft.PowerShellISE_profile.ps1 ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md index 24b56e3f814b..b324286083a8 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configuration_Files.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Session_Configuration_Files --- - # About Session Configuration Files ## SHORT DESCRIPTION @@ -354,7 +353,7 @@ session configurations. ```powershell Get-PSSessionConfiguration | -where {$_.ExecutionPolicy -eq "RemoteSigned"} +Where-Object {$_.ExecutionPolicy -eq "RemoteSigned"} ``` The following command gets session configurations in which the RunAsUser is @@ -362,7 +361,7 @@ the Exchange administrator. ```powershell Get-PSSessionConfiguration | -where {$_.RunAsUser -eq "Exchange01\Admin01"} +Where-Object {$_.RunAsUser -eq "Exchange01\Admin01"} ``` To view information about the role definitions associated with a configuration diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configurations.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configurations.md index c902878e0c6f..67f1eb6f2b5b 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configurations.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Session_Configurations.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/091/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Session_Configurations --- - # About Session Configurations ## SHORT DESCRIPTION @@ -102,7 +101,7 @@ Get-PSSessionConfiguration cmdlet. For example, type: ```powershell -PS C:> Get-PSSessionConfiguration | Format-List -Property Name, Permission +PS> Get-PSSessionConfiguration | Format-List -Property Name, Permission Name : microsoft.powershell Permission : BUILTIN\Administrators AccessAllowed @@ -122,7 +121,7 @@ For example, to see all of the properties of a session configuration object, type: ```powershell -PS C:> Get-PSSessionConfiguration | Format-List -Property * +PS> Get-PSSessionConfiguration | Format-List -Property * ``` You can also use the WSMan provider in PowerShell to view session @@ -136,7 +135,7 @@ For example, to view the session configurations on the local computer, type: ```powershell -PS C:> dir wsman:\localhost\plugin\microsoft* +PS> dir wsman:\localhost\plugin\microsoft* WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Plugin @@ -157,7 +156,7 @@ For example, the following command adds a node for the Server01 remote computer to the WSMAN: drive on the local computer. ```powershell -PS C:> Connect-WSMan server01.corp.fabrikam.com +PS> Connect-WSMan server01.corp.fabrikam.com ``` When the command is complete, you can navigate to the node for the Server01 @@ -166,7 +165,7 @@ computer to view the session configurations. For example: ```powershell -PS C:> cd wsman: +PS> cd wsman: PS WSMan:> dir @@ -212,7 +211,7 @@ the security descriptor for the Microsoft.PowerShell default session configuration. ```powershell -Set-PSSessionConfiguration -name Microsoft.PowerShell ` +Set-PSSessionConfiguration -Name Microsoft.PowerShell ` -ShowSecurityDescriptorUI ``` @@ -221,7 +220,7 @@ use the Disable-PSSessionConfiguration cmdlet. For example, the following command disables the default session configurations on the computer. ```powershell -PS C:> Disable-PSSessionConfiguration -Name Microsoft.PowerShell +PS> Disable-PSSessionConfiguration -Name Microsoft.PowerShell ``` To prevent remote users from connecting to the computer, but allow local users @@ -229,7 +228,7 @@ to connect, use the Disable-PSRemoting cmdlet. Disable-PSRemoting adds a "Network_Deny_All" entry to all session configurations on the computer. ```powershell -PS C:> Disable-PSRemoting +PS> Disable-PSRemoting ``` To allow remote users to use all session configurations on the computer, use @@ -238,7 +237,7 @@ the following command enables remote access to the built-in session configurations. ```powershell -PS C:> Enable-PSSessionConfiguration -name Microsoft.Power* +PS> Enable-PSSessionConfiguration -name Microsoft.Power* ``` To make other changes to the security descriptor of a session configuration, @@ -283,7 +282,7 @@ Unregister-PSSessionConfiguration cmdlet. For example, the following command removes the NewConfig session configuration from the computer. ```powershell -PS C:> Unregister-PSSessionConfiguration -Name NewConfig +PS> Unregister-PSSessionConfiguration -Name NewConfig ``` For more information, see Unregister-PSSessionConfiguration. @@ -312,7 +311,7 @@ on the Server01 computer. The command uses the ConfigurationName parameter to select the WithProfile configuration on the Server01 computer. ```powershell -PS C:> New-PSSession -ComputerName Server01 -ConfigurationName WithProfile +PS> New-PSSession -ComputerName Server01 -ConfigurationName WithProfile ``` This command will succeed only if the current user has permission to use the diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Signing.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Signing.md index bda83708f566..02facc9a0e6d 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Signing.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Signing.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Signing --- - # About Signing ## SHORT DESCRIPTION @@ -186,7 +185,7 @@ will not find a certificate file in the file system directory.) At the PowerShell prompt, type: ```powershell -get-childitem cert:\CurrentUser\my -codesigning +Get-ChildItem cert:\CurrentUser\my -codesigning ``` This command uses the PowerShell Certificate provider to view information diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Special_Characters.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Special_Characters.md index 7e5de57b95cb..89d7e1815bcc 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Special_Characters.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Special_Characters.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 06/09/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Special_Characters --- - # About Special Characters # SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Splatting.md index 8db566e6bcd8..cf4bd292ec29 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/03/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Splatting --- - # About Splatting ## SHORT DESCRIPTION diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Split.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Split.md index 63ec14e5915f..2ffb51d90a29 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Split.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Split.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/20/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Split --- - # About Split ## SHORT DESCRIPTION @@ -18,14 +17,14 @@ substrings. The Split operator splits one or more strings into substrings. You can change the following elements of the Split operation: -* Delimiter. The default is whitespace, but you can specify characters, +- Delimiter. The default is whitespace, but you can specify characters, strings, patterns, or script blocks that specify the delimiter. The Split operator in Windows PowerShell uses a regular expression in the delimiter, rather than a simple character. -* Maximum number of substrings. The default is to return all substrings. If +- Maximum number of substrings. The default is to return all substrings. If you specify a number less than the number of substrings, the remaining substrings are concatenated in the last substring. -* Options that specify the conditions under which the delimiter is matched, +- Options that specify the conditions under which the delimiter is matched, such as SimpleMatch and Multiline. ## SYNTAX @@ -188,28 +187,28 @@ The syntax for the Options parameter is: The SimpleMatch options are: -* **SimpleMatch**: Use simple string comparison when evaluating the +- **SimpleMatch**: Use simple string comparison when evaluating the delimiter. Cannot be used with RegexMatch. -* **IgnoreCase**: Forces case-insensitive matching, even if the -cSplit +- **IgnoreCase**: Forces case-insensitive matching, even if the -cSplit operator is specified. The RegexMatch options are: -* **RegexMatch**: Use regular expression matching to evaluate the +- **RegexMatch**: Use regular expression matching to evaluate the delimiter. This is the default behavior. Cannot be used with SimpleMatch. -* **IgnoreCase**: Forces case-insensitive matching, even if the -cSplit +- **IgnoreCase**: Forces case-insensitive matching, even if the -cSplit operator is specified. -* **CultureInvariant**: Ignores cultural differences in language +- **CultureInvariant**: Ignores cultural differences in language when evaluting the delimiter. Valid only with RegexMatch. -* IgnorePatternWhitespace: Ignores unescaped whitespace and +- IgnorePatternWhitespace: Ignores unescaped whitespace and comments marked with the number sign (#). Valid only with RegexMatch. -* **Multiline**: Multiline mode recognizes the start and end of lines +- **Multiline**: Multiline mode recognizes the start and end of lines and strings. Valid only with RegexMatch. Singleline is the default. -* **Singleline**: Singleline mode recognizes only the start and end of +- **Singleline**: Singleline mode recognizes only the start and end of strings. Valid only with RegexMatch. Singleline is the default. -* **ExplicitCapture**: Ignores non-named match groups so that only +- **ExplicitCapture**: Ignores non-named match groups so that only explicit capture groups are returned in the result list. Valid only with RegexMatch. diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Switch.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Switch.md index 54eccc88f218..f8af51eb9069 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Switch.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Switch.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/06/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Switch --- - # About Switch ## SHORT DESCRIPTION @@ -198,7 +197,8 @@ For the word "fourteen" to match a case you must use the **-Wildcard** or Result: - ```Output + +```Output That's too many. ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_Throw.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_Throw.md index 6145c14b6535..aecc933a5a14 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_Throw.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_Throw.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 12/01/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Throw --- - # About Throw ## SHORT DESCRIPTION @@ -38,7 +37,7 @@ not appear in a Catch block, and it does not include an expression, it generates a ScriptHalted error. ```powershell -C:\PS> throw +PS> throw ScriptHalted At line:1 char:6 @@ -57,7 +56,7 @@ The optional expression in a Throw statement can be a string, as shown in the following example: ```powershell -C:\PS> throw "This is an error." +PS> throw "This is an error." This is an error. At line:1 char:6 @@ -73,11 +72,11 @@ The expression can also be an object that throws the object that represents the PowerShell process, as shown in the following example: ```powershell -C:\PS> throw (get-process PowerShell) +PS> throw (Get-Process PowerShell) System.Diagnostics.Process (PowerShell) At line:1 char:6 -+ throw <<<< (get-process PowerShell) ++ throw <<<< (Get-Process PowerShell) + CategoryInfo : OperationStopped: (System.Diagnostics.Process (Pow erShell):Process) [], RuntimeException @@ -88,7 +87,7 @@ You can use the TargetObject property of the ErrorRecord object in the $error automatic variable to examine the error. ```powershell -C:\PS> $error[0].targetobject +PS> $error[0].targetobject Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- @@ -100,9 +99,9 @@ exception. The following example uses the Throw keyword to throw a System.FormatException object. ```powershell -C:\PS> $formatError = new-object system.formatexception +PS> $formatError = new-object system.formatexception -C:\PS> throw $formatError +PS> throw $formatError One of the identified items was in an invalid format. At line:1 char:6 @@ -145,7 +144,7 @@ function Get-XMLFiles param ($path = $(throw "The Path parameter is required.")) dir -path $path\*.xml -recurse | sort lastwritetime | - ft lastwritetime, attributes, name -auto + Format-Table lastwritetime, attributes, name -AutoSize } ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_scopes.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_scopes.md index 6137b7bab05b..93bddbb0554d 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_scopes.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_scopes.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 01/08/2018 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_scopes --- - # About Scopes about_Scopes @@ -99,13 +98,13 @@ Get-Variable or Get-Alias. For example, to get all the variables in the local scope, type: ```powershell -get-variable -scope local +Get-Variable -Scope local ``` To get all the variables in the global scope, type: ```powershell -get-variable -scope global +Get-Variable -Scope global ``` ## Scope Modifiers @@ -156,7 +155,7 @@ definition creates a function in the global scope: ```powershell function global:Hello { - write-host "Hello, World" + Write-Host "Hello, World" } ``` @@ -197,7 +196,7 @@ change) items in a particular scope. Use the following command to find all the cmdlets in your session that have a Scope parameter: ```powershell -get-help * -parameter scope +Get-Help * -Parameter scope ``` To find the variables that are visible in a particular scope, use the Scope @@ -208,7 +207,7 @@ For example, the following command gets the variables that are visible in the local scope: ```powershell -get-variable -scope local +Get-Variable -Scope local ``` To create a variable in a particular scope, use a scope modifier or the Scope @@ -216,7 +215,7 @@ parameter of Set-Variable. The following command creates a variable in the global scope: ```powershell -new-variable -scope global -name a -value "One" +New-Variable -Scope global -Name a -Value "One" ``` You can also use the Scope parameter of the New-Alias, Set-Alias, or Get-Alias @@ -224,7 +223,7 @@ cmdlets to specify the scope. The following command creates an alias in the global scope: ```powershell -new-alias -scope global -name np -value Notepad.exe +New-Alias -Scope global -Name np -Value Notepad.exe ``` To get the functions in a particular scope, use the Get-Item cmdlet when you @@ -349,7 +348,7 @@ First, to display the value of the \$ConfirmPreference variable in the local scope, use the following command: ``` -C:\PS> $ConfirmPreference +PS> $ConfirmPreference High ``` @@ -372,7 +371,7 @@ Next, test the current value of the \$ConfirmPreference variable in the current scope. ``` -C:\PS> $ConfirmPreference +PS> $ConfirmPreference High ``` @@ -413,7 +412,7 @@ When the script is complete, only the global value of \$test is defined in the session. ``` -C:\PS> $test +PS> $test Global ``` @@ -442,7 +441,7 @@ $global:test = "Local" When the script is complete, the global value of \$test is changed. ``` -C:\PS> $test +PS> $test Local ``` @@ -462,11 +461,11 @@ New-Variable -Name ptest -Value 1 -Option private You can display and change the value of \$ptest in the local scope. ``` -C:\PS> $ptest +PS> $ptest 1 -C:\PS> $ptest = 2 -C:\PS> $ptest +PS> $ptest = 2 +PS> $ptest 2 ``` diff --git a/reference/3.0/Microsoft.PowerShell.Core/About/about_simplified_syntax.md b/reference/3.0/Microsoft.PowerShell.Core/About/about_simplified_syntax.md index ac9e4de8c2fc..3a840ddad781 100644 --- a/reference/3.0/Microsoft.PowerShell.Core/About/about_simplified_syntax.md +++ b/reference/3.0/Microsoft.PowerShell.Core/About/about_simplified_syntax.md @@ -1,11 +1,10 @@ ---- +--- ms.date: 06/09/2017 schema: 2.0.0 locale: en-us keywords: powershell,cmdlet title: about_Simplified_Syntax --- - # about_Simplified_Syntax ## SHORT DESCRIPTION