Updates from: 02/25/2021 04:14:54
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Core About Comparison Operators (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md
--- description: Describes the operators that compare values in PowerShell. Locale: en-US Previously updated : 01/20/2021 Last updated : 02/19/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about_Comparison_Operators
$null -ne $a
``` ```output
-False
+True
``` The following, however, filers out all null elements from `$a`:
Microsoft.PowerShell.Management Clear Eventlog (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Management/Clear-EventLog.md
Clear-EventLog [-LogName] <String[]> [[-ComputerName] <String[]>] [-WhatIf] [-Co
## DESCRIPTION
-The `Clear-EventLog` cmdlet deletes all of the entries from the specified event logs on the local computer or on remote computers.
-To use `Clear-EventLog`, you must be a member of the Administrators group on the affected computer.
+The `Clear-EventLog` cmdlet deletes all of the entries from the specified event logs on the local
+computer or on remote computers. To use `Clear-EventLog`, you must be a member of the Administrators
+group on the affected computer.
-The cmdlets that contain the **EventLog** noun (the EventLog cmdlets) work only on classic event logs.
-To get events from logs that use the Windows Event Log technology in Windows Vista and later versions of Windows, use the Get-WinEvent cmdlet.
+The cmdlets that contain the **EventLog** noun (the EventLog cmdlets) work only on classic event
+logs. To get events from logs that use the Windows Event Log technology in Windows Vista and later
+versions of Windows, use the Get-WinEvent cmdlet.
## EXAMPLES
This command clears the entries from the Windows PowerShell event log on the loc
Clear-EventLog -LogName ODiag, OSession -ComputerName localhost, Server02 ```
-This command clears all of the entries in the Microsoft Office Diagnostics (ODiag) and Microsoft Office Sessions (OSession) logs on the local computer and the Server02 remote computer.
+This command clears all of the entries in the Microsoft Office Diagnostics (ODiag) and Microsoft
+Office Sessions (OSession) logs on the local computer and the Server02 remote computer.
### Example 3: Clear all logs on the specified computers then display the event log list
Max(K) Retain OverflowAction Entries Log
15,360 0 OverwriteAsNeeded 0 Windows PowerShell ```
-This function clears all event logs on the specified computers and then displays the resulting event log list.
+This function clears all event logs on the specified computers and then displays the resulting event
+log list.
-Notice that a few entries were added to the System and Security logs after the logs were cleared but before they were displayed.
+Notice that a few entries were added to the System and Security logs after the logs were cleared but
+before they were displayed.
## PARAMETERS ### -ComputerName
-Specifies a remote computer.
-The default is the local computer.
+Specifies a remote computer. The default is the local computer.
-Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name of a remote computer.
-To specify the local computer, type the computer name, a dot (.), or "localhost".
+Type the NetBIOS name, an Internet Protocol (IP) address, or a fully qualified domain name of a
+remote computer. To specify the local computer, type the computer name, a dot (.), or "localhost".
-This parameter does not rely on Windows PowerShell remoting.
-You can use the **ComputerName** parameter of `Get-EventLog` even if your computer is not configured to run remote commands.
+This parameter does not rely on Windows PowerShell remoting. You can use the **ComputerName**
+parameter of `Get-EventLog` even if your computer is not configured to run remote commands.
```yaml Type: System.String[]
Accept wildcard characters: False
### -LogName
-Specifies the event logs.
-Enter the log name (the value of the Log property; not the LogDisplayName) of one or more event logs, separated by commas.
-Wildcard characters are not permitted.
-This parameter is required.
+Specifies the event logs. Enter the log name (the value of the **Log** property not the
+**LogDisplayName**) of one or more event logs, separated by commas. Wildcard characters are not
+permitted. This parameter is required.
+
+> [!IMPORTANT]
+> This parameter is supposed to accept values from the pipeline by property name. However, there is
+> a bug that prevents this from working. You must pass a value using the parameter directly.
```yaml Type: System.String[]
Accept wildcard characters: False
### CommonParameters
-This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
+-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
+-WarningAction, and -WarningVariable. For more information, see
+[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
## INPUTS
This cmdlet does not generate any output.
## NOTES -- To use `Clear-EventLog` on Windows Vista and later versions of Windows, start Windows PowerShell with the "Run as administrator" option.
+- To use `Clear-EventLog` on Windows Vista and later versions of Windows, start Windows PowerShell
+ with the "Run as administrator" option.
## RELATED LINKS
Microsoft.PowerShell.Security Get Authenticodesignature (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Security/Get-AuthenticodeSignature.md
Get-AuthenticodeSignature -SourcePathOrExtension <String[]> -Content <Byte[]> [<
## DESCRIPTION The `Get-AuthenticodeSignature` cmdlet gets information about the Authenticode signature for a
-file or file content as a byte array. If the file is not signed, the information is retrieved, but
+file or file content as a byte array.
+If the file is both embedded signed and Windows catalog signed,
+the Windows catalog signature is used.
+If the file is not signed, the information is retrieved, but
the fields are blank. ## EXAMPLES
PSScheduledJob About Scheduled Jobs Troubleshooting (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/PSScheduledJob/About/about_Scheduled_Jobs_Troubleshooting.md
Use the `Get-ScheduledJobOption` cmdlet to examine the job options and their
values. ```powershell
-Get-ScheduledJob -Name ProcessJob
+Get-ScheduledJobOption -Name ProcessJob
``` ```Output
Microsoft.PowerShell.Core About Comparison Operators (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md
--- description: Describes the operators that compare values in PowerShell. Locale: en-US Previously updated : 01/20/2021 Last updated : 02/19/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about_Comparison_Operators
$null -ne $a
``` ```output
-False
+True
``` The following, however, filers out all null elements from `$a`:
Microsoft.PowerShell.Core Foreach Object (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/ForEach-Object.md
external help file: System.Management.Automation.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Core Previously updated : 09/08/2020 Last updated : 02/18/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: ForEach-Object
Output: 5
`Output: 3` is never written because the parallel scriptblock for that iteration was terminated.
+### Example 16: Passing variables in nested parallel script ScriptBlockSet
+
+You can create a variable outside a `Foreach-Object -Parallel` scoped scriptblock and use
+it inside the scriptblock with the `$using` keyword.
+
+```powershell
+$test1 = 'TestA'
+1..2 | Foreach-Object -Parallel {
+ $using:test1
+}
+```
+
+```Output
+TestA
+TestA
+```
+
+You _cannot_ create a variable _inside_ a scoped scriptblock to be used in a nested foreach parallel
+scriptblock.
+
+```powershell
+$test1 = 'TestA'
+1..2 | Foreach-Object -Parallel {
+ $using:test1
+ $test2 = 'TestB'
+ 1..2 | Foreach-Object -Parallel {
+ $using:test2
+ }
+}
+```
+
+```Output
+Line |
+ 2 | 1..2 | Foreach-Object -Parallel {
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | The value of the using variable '$using:test2' cannot be retrieved because it has not been set in the local session.
+```
+
+The nested scriptblock can't access the `$test2` variable and an error is thrown.
+ ## Parameters ### -ArgumentList
Microsoft.PowerShell.Security Get Authenticodesignature (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Security/Get-AuthenticodeSignature.md
Get-AuthenticodeSignature -SourcePathOrExtension <String[]> -Content <Byte[]> [<
## DESCRIPTION The `Get-AuthenticodeSignature` cmdlet gets information about the Authenticode signature for a
-file or file content as a byte array. If the file is not signed, the information is retrieved, but
+file or file content as a byte array.
+If the file is both embedded signed and Windows catalog signed,
+the Windows catalog signature is used.
+If the file is not signed, the information is retrieved, but
the fields are blank. ## EXAMPLES
Microsoft.PowerShell.Core About Comparison Operators (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md
--- description: Describes the operators that compare values in PowerShell. Locale: en-US Previously updated : 01/20/2021 Last updated : 02/19/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about_Comparison_Operators
$null -ne $a
``` ```output
-False
+True
``` The following, however, filers out all null elements from `$a`:
Microsoft.PowerShell.Core Foreach Object (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/ForEach-Object.md
external help file: System.Management.Automation.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Core Previously updated : 09/08/2020 Last updated : 02/18/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: ForEach-Object
Output: 5
`Output: 3` is never written because the parallel scriptblock for that iteration was terminated.
+### Example 16: Passing variables in nested parallel script ScriptBlockSet
+
+You can create a variable outside a `Foreach-Object -Parallel` scoped scriptblock and use
+it inside the scriptblock with the `$using` keyword.
+
+```powershell
+$test1 = 'TestA'
+1..2 | Foreach-Object -Parallel {
+ $using:test1
+}
+```
+
+```Output
+TestA
+TestA
+```
+
+You _cannot_ create a variable _inside_ a scoped scriptblock to be used in a nested foreach parallel
+scriptblock.
+
+```powershell
+$test1 = 'TestA'
+1..2 | Foreach-Object -Parallel {
+ $using:test1
+ $test2 = 'TestB'
+ 1..2 | Foreach-Object -Parallel {
+ $using:test2
+ }
+}
+```
+
+```Output
+Line |
+ 2 | 1..2 | Foreach-Object -Parallel {
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ | The value of the using variable '$using:test2' cannot be retrieved because it has not been set in the local session.
+```
+
+The nested scriptblock can't access the `$test2` variable and an error is thrown.
+ ## Parameters ### -ArgumentList
Microsoft.PowerShell.Security Get Authenticodesignature (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Security/Get-AuthenticodeSignature.md
Get-AuthenticodeSignature -SourcePathOrExtension <String[]> -Content <Byte[]> [<
## DESCRIPTION The `Get-AuthenticodeSignature` cmdlet gets information about the Authenticode signature for a
-file or file content as a byte array. If the file is not signed, the information is retrieved, but
+file or file content as a byte array.
+If the file is both embedded signed and Windows catalog signed,
+the Windows catalog signature is used.
+If the file is not signed, the information is retrieved, but
the fields are blank. ## EXAMPLES
Microsoft.PowerShell.Core About Comparison Operators (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md
--- description: Describes the operators that compare values in PowerShell. Locale: en-US Previously updated : 01/20/2021 Last updated : 02/19/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about_Comparison_Operators
$null -ne $a
``` ```output
-False
+True
``` The following, however, filers out all null elements from `$a`:
Microsoft.PowerShell.Security Get Authenticodesignature (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Security/Get-AuthenticodeSignature.md
Get-AuthenticodeSignature -SourcePathOrExtension <String[]> -Content <Byte[]> [<
## DESCRIPTION The `Get-AuthenticodeSignature` cmdlet gets information about the Authenticode signature for a
-file or file content as a byte array. If the file is not signed, the information is retrieved, but
+file or file content as a byte array.
+If the file is both embedded signed and Windows catalog signed,
+the Windows catalog signature is used.
+If the file is not signed, the information is retrieved, but
the fields are blank. ## EXAMPLES
PSReadLine About Psreadline (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/PSReadLine/About/about_PSReadLine.md
Delete the character before the cursor.
- Vi insert mode: `<Backspace>` - Vi command mode: `<X>`, `<d,h>`
-### BackwardDeleteLine
+### BackwardDeleteInput
-Like BackwardKillLine - deletes text from the point to the start of the line,
+Like BackwardKillInput - deletes text from the point to the start of the input,
but does not put the deleted text in the kill-ring. - Cmd: `<Ctrl+Home>` - Vi insert mode: `<Ctrl+u>`, `<Ctrl+Home>`-- Vi command mode: `<Ctrl+u>`, `<Ctrl+Home>`, `<d,0>`
+- Vi command mode: `<Ctrl+u>`, `<Ctrl+Home>`
+
+### BackwardDeleteLine
+
+Like BackwardKillLine - deletes text from the point to the start of the line,
+but does not put the deleted text in the kill-ring.
+
+- Vi command mode: `<d,0>`
### BackwardDeleteWord
Deletes the previous word.
- Vi command mode: `<Ctrl+w>`, `<d,b>`
-### BackwardKillLine
+### BackwardKillInput
-Clear the input from the start of the input to the cursor. The cleared text is
+Clear the text from the start of the input to the cursor. The cleared text is
placed in the kill-ring. - Emacs: `<Ctrl+u>`, `<Ctrl+x,Backspace>`
+### BackwardKillLine
+
+Clear the text from the start of the current logical line to the cursor. The cleared text is
+placed in the kill-ring.
+
+- Function is unbound.
+ ### BackwardKillWord Clear the input from the start of the current word to the cursor. If the
Delete the next word.
- Vi command mode: `<d,w>`
-### ForwardDeleteLine
+### ForwardDeleteInput
-Like ForwardKillLine - deletes text from the point to the end of the line, but
+Like KillLine - deletes text from the point to the end of the input, but
does not put the deleted text in the kill-ring. - Cmd: `<Ctrl+End>` - Vi insert mode: `<Ctrl+End>` - Vi command mode: `<Ctrl+End>`
+### ForwardDeleteLine
+
+Deletes text from the point to the end of the current logical line, but
+does not put the deleted text in the kill-ring.
+
+- Function is unbound
+ ### InsertLineAbove A new empty line is created above the current line regardless of where the
Adjust the current selection to include the previous word.
### SelectCommandArgument
-Make visual selection of the command arguments.
+Make visual selection of the command arguments. Selection of arguments is scoped
+within a script block. Based on the cursor position, it searches from the innermost
+script block to the outmost script block, and stops when it finds any arguments
+in a script block scope.
+
+This function honors DigitArgument. It treats the positive or negative argument
+values as the forward or backward offsets from the currently selected argument,
+or from the current cursor position when no argument is selected.
- Cmd: `<Alt+a>` - Emacs: `<Alt+a>`
learn Everything About Exceptions https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/learn/deep-dives/everything-about-exceptions.md
At line:1 char:1
#### Write-Error -ErrorAction Stop I mentioned that `Write-Error` doesn't throw a terminating error by default. If you specify
-`-ErrorAction Stop`, `Write-Error`generates a terminating error that can be handled with a
+`-ErrorAction Stop`, `Write-Error` generates a terminating error that can be handled with a
`catch`. ```powershell
learn Everything About Hashtable https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/learn/deep-dives/everything-about-hashtable.md
executed where `$_` is the value of the object on the pipe. Here is that script
```powershell $drives = Get-PSDrive | Where Used
-$drives | Select-Object -Properties name, $property
+$drives | Select-Object -Property name, $property
Name totalSpaceGB ---- ------------
I placed that in a variable but it could easily be defined inline and you can sh
and `expression` to `e` while you're at it. ```powershell
-$drives | Select-Object -properties name, @{n='totalSpaceGB';e={($_.used + $_.free) / 1GB}}
+$drives | Select-Object -property name, @{n='totalSpaceGB';e={($_.used + $_.free) / 1GB}}
``` I personally don't like how long that makes commands and it often promotes some bad behaviors that I
windows-powershell Keyboard Shortcuts For The Windows Powershell ISE https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md
You can use the following keyboard shortcuts when you edit text.
| Action | Keyboard Shortcuts | Use in | | -------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Help** | <kbd>F1</kbd> | Script Pane **Important:** You can specify that <kbd>F1</kbd> help comes from docs.microsoft.com or downloaded Help (see `Update-Help`). To select, click **Tools**, **Options**, then on the **General Settings** tab, set or clear **Use local help content instead of online content.** |
+| **Select All** | <kbd>CTRL</kbd>+<kbd>A</kbd> | Script Pane |
| **Copy** | <kbd>CTRL</kbd>+<kbd>C</kbd> | Script Pane, Command Pane, Output Pane | | **Cut** | <kbd>CTRL</kbd>+<kbd>X</kbd> | Script Pane, Command Pane | | **Expand or Collapse Outlining** | <kbd>CTRL</kbd>+<kbd>M</kbd> | Script Pane |
You can use the following keyboard shortcuts when you edit text.
| **Select All** | <kbd>CTRL</kbd>+<kbd>A</kbd> | Script Pane, Command Pane, Output Pane | | **Show Snippets** | <kbd>CTRL</kbd>+<kbd>J</kbd> | Script Pane, Command Pane | | **Undo** | <kbd>CTRL</kbd>+<kbd>Z</kbd> | Script Pane, Command Pane |
+| **Show Intellisense Help** | <kbd>CTRL</kbd>+<kbd>Space</kbd> | Script Pane |
+| **Delete word to left** | <kbd>CTRL</kbd>+<kbd>Backspace</kbd> | Script Pane |
+| **Delete word to right** | <kbd>CTRL</kbd>+<kbd>Delete</kbd> | Script Pane |
## Keyboard shortcuts for running scripts