Updates from: 08/11/2021 03:20:11
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Utility Invoke Expression (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Invoke-Expression.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 04/08/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-Expression --- # Invoke-Expression
-## SYNOPSIS
+## Synopsis
Runs commands or expressions on the local computer.
-## SYNTAX
+## Syntax
``` Invoke-Expression [-Command] <String> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-Expression` cmdlet evaluates or runs a specified string as a command and returns the results of the expression or command. Without `Invoke-Expression`, a string submitted at the command
Expressions are evaluated and run in the current scope. For more information, se
> before running it. In general, it is best to design your script with predefined input options, > rather than allowing freeform input.
-## EXAMPLES
+## Examples
### Example 1: Evaluate an expression
would be replaced by its value before it was saved in the `$Command` variable.
### Example 4: Get and run a cmdlet Help example ```powershell
-$Cmdlet_name = "Get-EventLog"
+$Cmdlet_name = "Get-ComputerInfo"
$Example_number = 1 $Example_code = (Get-Help $Cmdlet_name).examples.example[($Example_number-1)].code Invoke-Expression $Example_code
To run an example of a different cmdlet, change the value of the `$Cmdlet_name`
of the cmdlet. And, change the `$Example_number` variable to the example number you want to run. The command fails if the example number is not valid.
-## PARAMETERS
+> [!NOTE]
+> If the example code from the help file has output in the example, PowerShell attempts to run the
+> output along with the code and an error will be thrown.
+
+## Parameters
### -Command
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String or PSObject You can pipe an object that represents the command to `Invoke-Expression`. Use the `$Input` automatic variable to represent the input objects in the command.
-## OUTPUTS
+## Outputs
### PSObject Returns the output that is generated by the invoked command (the value of the **Command** parameter).
-## NOTES
+## Notes
In most cases, you invoke expressions using PowerShell's call operator and achieve the same results. The call operator is a safer method. For more information, see [about_Operators](../microsoft.powershell.core/about/about_operators.md#call-operator-).
-## RELATED LINKS
+## Related links
[Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md)
Microsoft.PowerShell.Utility Invoke Webrequest (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
This cmdlet was introduced in Windows PowerShell 3.0.
> `ParsedHtml` property. Use the `-UseBasicParsing` switch to suppress this. > [!IMPORTANT]
-> The examples in this article reference hosts in the `constoso.com` domain. This is a fictitious
+> The examples in this article reference hosts in the `contoso.com` domain. This is a fictitious
> domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets. > However, since the `contoso.com` sites do not exist, the examples do not work. Adapt the examples > to hosts in your environment.
Microsoft.PowerShell.Utility Write Output (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Write-Output.md
--- external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 10/14/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/write-output?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Write-Output
Title: Write-Output
# Write-Output ## SYNOPSIS
-Sends the specified objects to the next command in the pipeline. If the command is the last command
-in the pipeline, the objects are displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
## SYNTAX
Write-Output [-InputObject] <PSObject[]> [-NoEnumerate] [<CommonParameters>]
## DESCRIPTION
-The `Write-Output` cmdlet sends the specified object down the pipeline to the next command.
-If the command is the last command in the pipeline, the object is displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
-`Write-Output` sends objects down the primary pipeline, also known as the "output stream" or the
-"success pipeline." To send error objects down the error pipeline, use Write-Error.
+`Write-Output` sends objects to the primary pipeline, also known as the "output stream" or the
+"success pipeline." To send error objects to the error pipeline, use `Write-Error`.
This cmdlet is typically used in scripts to display strings and other objects on the console. One of
-the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`, the
+the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`. The
default behavior is to display the output at the end of a pipeline. In PowerShell, it is generally not necessary to use the cmdlet in instances where the output is displayed by default. For example, `Get-Process | Write-Output` is equivalent to `Get-Process`. Or, `echo "Home directory: $HOME"` can be written, `"Home directory: $HOME"`.
-By default, `Write-Output` enumerates through collections provided to the cmdlet. However,
-`Write-Output` can also be used to pass collections down the pipeline as a single object with the
-**NoEnumerate** parameter.
+By default, `Write-Output` enumerates through collection objects. However, `Write-Output` can also
+be used to pass collections down the pipeline as a single object with the **NoEnumerate** parameter.
## EXAMPLES ### Example 1: Get objects and write them to the console
+In this example, the results of the `Get-Process` cmdlet are stored in the `$P` variable. The
+`Write-Output` cmdlet displays the process objects in `$P` to the console.
+ ```powershell $P = Get-Process Write-Output $P ```
-The first command gets processes running on the computer and stores them in the `$P` variable.
-
-The second and third commands display the process objects in `$P` on the console.
- ### Example 2: Pass output to another cmdlet
+This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
+of the **System.String** class, demonstrating that the string was passed along the pipeline.
+ ```powershell Write-Output "test output" | Get-Member ```
-This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
-of the **System.String** class, demonstrating that the string was passed along the pipeline.
- ### Example 3: Suppress enumeration in output
+This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
+through the pipeline.
+ ```powershell Write-Output 1,2,3 | Measure-Object ```
Count : 1
... ```
-This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
-through the pipeline.
- ## PARAMETERS ### -InputObject
suppresses the default behavior, and prevents `Write-Output` from enumerating ou
**NoEnumerate** parameter has no effect if the command is wrapped in parentheses, because the parentheses force enumeration. For example, `(Write-Output 1,2,3)` still enumerates the array.
+The **NoEnumerate** parameter is only useful within a pipeline. Trying to see the effects of
+**NoEnumerate** in the console is problematic because PowerShell adds `Out-Default` to the end of
+every command line, which results in enumeration. But if you pipe `Write-Output -NoEnumerate` to
+another cmdlet, the downstream cmdlet receives the collection object, not the enumerated items of
+the collection.
+ > [!IMPORTANT] > There is an issue with this switch in Windows PowerShell that is fixed in PowerShell 6.2 and > above. When using **NoEnumerate** and explicitly using the **InputObject** parameter, the command
Microsoft.PowerShell.Utility Invoke Expression (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Invoke-Expression.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 04/08/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-Expression --- # Invoke-Expression
-## SYNOPSIS
+## Synopsis
Runs commands or expressions on the local computer.
-## SYNTAX
+## Syntax
``` Invoke-Expression [-Command] <String> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-Expression` cmdlet evaluates or runs a specified string as a command and returns the results of the expression or command. Without `Invoke-Expression`, a string submitted at the command
Expressions are evaluated and run in the current scope. For more information, se
> before running it. In general, it is best to design your script with predefined input options, > rather than allowing freeform input.
-## EXAMPLES
+## Examples
### Example 1: Evaluate an expression
would be replaced by its value before it was saved in the `$Command` variable.
### Example 4: Get and run a cmdlet Help example ```powershell
-$Cmdlet_name = "Get-EventLog"
+$Cmdlet_name = "Get-ComputerInfo"
$Example_number = 1 $Example_code = (Get-Help $Cmdlet_name).examples.example[($Example_number-1)].code Invoke-Expression $Example_code
To run an example of a different cmdlet, change the value of the `$Cmdlet_name`
of the cmdlet. And, change the `$Example_number` variable to the example number you want to run. The command fails if the example number is not valid.
-## PARAMETERS
+> [!NOTE]
+> If the example code from the help file has output in the example, PowerShell attempts to run the
+> output along with the code and an error will be thrown.
+
+## Parameters
### -Command
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String or PSObject You can pipe an object that represents the command to `Invoke-Expression`. Use the `$Input` automatic variable to represent the input objects in the command.
-## OUTPUTS
+## Outputs
### PSObject Returns the output that is generated by the invoked command (the value of the **Command** parameter).
-## NOTES
+## Notes
In most cases, you invoke expressions using PowerShell's call operator and achieve the same results. The call operator is a safer method. For more information, see [about_Operators](../microsoft.powershell.core/about/about_operators.md#call-operator-).
-## RELATED LINKS
+## Related links
[Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md)
Microsoft.PowerShell.Utility Invoke Webrequest (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
Beginning in PowerShell 7.0, `Invoke-WebRequest` supports proxy configuration de
variables. See the [Notes](#notes) section of this article. > [!IMPORTANT]
-> The examples in this article reference hosts in the `constoso.com` domain. This is a fictitious
+> The examples in this article reference hosts in the `contoso.com` domain. This is a fictitious
> domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets. > However, since the `contoso.com` sites do not exist, the examples do not work. Adapt the examples > to hosts in your environment.
Microsoft.PowerShell.Utility Write Output (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Write-Output.md
--- external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 10/14/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/write-output?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Write-Output
Title: Write-Output
# Write-Output ## SYNOPSIS
-Sends the specified objects to the next command in the pipeline. If the command is the last command
-in the pipeline, the objects are displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
## SYNTAX
Write-Output [-InputObject] <PSObject[]> [-NoEnumerate] [<CommonParameters>]
## DESCRIPTION
-The `Write-Output` cmdlet sends the specified object down the pipeline to the next command.
-If the command is the last command in the pipeline, the object is displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
-`Write-Output` sends objects down the primary pipeline, also known as the "output stream" or the
-"success pipeline." To send error objects down the error pipeline, use Write-Error.
+`Write-Output` sends objects to the primary pipeline, also known as the "output stream" or the
+"success pipeline." To send error objects to the error pipeline, use `Write-Error`.
This cmdlet is typically used in scripts to display strings and other objects on the console. One of
-the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`, the
+the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`. The
default behavior is to display the output at the end of a pipeline. In PowerShell, it is generally not necessary to use the cmdlet in instances where the output is displayed by default. For example, `Get-Process | Write-Output` is equivalent to `Get-Process`. Or, `echo "Home directory: $HOME"` can be written, `"Home directory: $HOME"`.
-By default, `Write-Output` enumerates through collections provided to the cmdlet. However,
-`Write-Output` can also be used to pass collections down the pipeline as a single object with the
-**NoEnumerate** parameter.
+By default, `Write-Output` enumerates through collection objects. However, `Write-Output` can also
+be used to pass collections down the pipeline as a single object with the **NoEnumerate** parameter.
## EXAMPLES ### Example 1: Get objects and write them to the console
+In this example, the results of the `Get-Process` cmdlet are stored in the `$P` variable. The
+`Write-Output` cmdlet displays the process objects in `$P` to the console.
+ ```powershell $P = Get-Process Write-Output $P ```
-The first command gets processes running on the computer and stores them in the `$P` variable.
-
-The second and third commands display the process objects in `$P` on the console.
- ### Example 2: Pass output to another cmdlet
+This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
+of the **System.String** class, demonstrating that the string was passed along the pipeline.
+ ```powershell Write-Output "test output" | Get-Member ```
-This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
-of the **System.String** class, demonstrating that the string was passed along the pipeline.
- ### Example 3: Suppress enumeration in output
+This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
+through the pipeline.
+ ```powershell Write-Output 1,2,3 | Measure-Object ```
Count : 1
... ```
-This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
-through the pipeline.
- ## PARAMETERS ### -InputObject
suppresses the default behavior, and prevents `Write-Output` from enumerating ou
**NoEnumerate** parameter has no effect if the command is wrapped in parentheses, because the parentheses force enumeration. For example, `(Write-Output 1,2,3)` still enumerates the array.
-> [!NOTE]
-> This switch only works correctly with PowerShell Core 6.2 and newer. On older versions of
-> PowerShell Core, the collection is still enumerated even with use of this switch.
+The **NoEnumerate** parameter is only useful within a pipeline. Trying to see the effects of
+**NoEnumerate** in the console is problematic because PowerShell adds `Out-Default` to the end of
+every command line, which results in enumeration. But if you pipe `Write-Output -NoEnumerate` to
+another cmdlet, the downstream cmdlet receives the collection object, not the enumerated items of
+the collection.
```yaml Type: System.Management.Automation.SwitchParameter
Microsoft.PowerShell.Utility Invoke Expression (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Invoke-Expression.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 04/08/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-Expression --- # Invoke-Expression
-## SYNOPSIS
+## Synopsis
Runs commands or expressions on the local computer.
-## SYNTAX
+## Syntax
``` Invoke-Expression [-Command] <String> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-Expression` cmdlet evaluates or runs a specified string as a command and returns the results of the expression or command. Without `Invoke-Expression`, a string submitted at the command
Expressions are evaluated and run in the current scope. For more information, se
> before running it. In general, it is best to design your script with predefined input options, > rather than allowing freeform input.
-## EXAMPLES
+## Examples
### Example 1: Evaluate an expression
would be replaced by its value before it was saved in the `$Command` variable.
### Example 4: Get and run a cmdlet Help example ```powershell
-$Cmdlet_name = "Get-EventLog"
+$Cmdlet_name = "Get-ComputerInfo"
$Example_number = 1 $Example_code = (Get-Help $Cmdlet_name).examples.example[($Example_number-1)].code Invoke-Expression $Example_code
To run an example of a different cmdlet, change the value of the `$Cmdlet_name`
of the cmdlet. And, change the `$Example_number` variable to the example number you want to run. The command fails if the example number is not valid.
-## PARAMETERS
+> [!NOTE]
+> If the example code from the help file has output in the example, PowerShell attempts to run the
+> output along with the code and an error will be thrown.
+
+## Parameters
### -Command
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String or PSObject You can pipe an object that represents the command to `Invoke-Expression`. Use the `$Input` automatic variable to represent the input objects in the command.
-## OUTPUTS
+## Outputs
### PSObject Returns the output that is generated by the invoked command (the value of the **Command** parameter).
-## NOTES
+## Notes
In most cases, you invoke expressions using PowerShell's call operator and achieve the same results. The call operator is a safer method. For more information, see [about_Operators](../microsoft.powershell.core/about/about_operators.md#call-operator-).
-## RELATED LINKS
+## Related links
[Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md)
Microsoft.PowerShell.Utility Invoke Webrequest (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
Beginning in PowerShell 7.0, `Invoke-WebRequest` supports proxy configuration de
variables. See the [Notes](#notes) section of this article. > [!IMPORTANT]
-> The examples in this article reference hosts in the `constoso.com` domain. This is a fictitious
+> The examples in this article reference hosts in the `contoso.com` domain. This is a fictitious
> domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets. > However, since the `contoso.com` sites do not exist, the examples do not work. Adapt the examples > to hosts in your environment.
Microsoft.PowerShell.Utility Write Output (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Write-Output.md
--- external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 10/14/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/write-output?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Write-Output
Title: Write-Output
# Write-Output ## SYNOPSIS
-Sends the specified objects to the next command in the pipeline. If the command is the last command
-in the pipeline, the objects are displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
## SYNTAX
Write-Output [-InputObject] <PSObject[]> [-NoEnumerate] [<CommonParameters>]
## DESCRIPTION
-The `Write-Output` cmdlet sends the specified object down the pipeline to the next command.
-If the command is the last command in the pipeline, the object is displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
-`Write-Output` sends objects down the primary pipeline, also known as the "output stream" or the
-"success pipeline." To send error objects down the error pipeline, use Write-Error.
+`Write-Output` sends objects to the primary pipeline, also known as the "output stream" or the
+"success pipeline." To send error objects to the error pipeline, use `Write-Error`.
This cmdlet is typically used in scripts to display strings and other objects on the console. One of
-the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`, the
+the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`. The
default behavior is to display the output at the end of a pipeline. In PowerShell, it is generally not necessary to use the cmdlet in instances where the output is displayed by default. For example, `Get-Process | Write-Output` is equivalent to `Get-Process`. Or, `echo "Home directory: $HOME"` can be written, `"Home directory: $HOME"`.
-By default, `Write-Output` enumerates through collections provided to the cmdlet. However,
-`Write-Output` can also be used to pass collections down the pipeline as a single object with the
-**NoEnumerate** parameter.
+By default, `Write-Output` enumerates through collection objects. However, `Write-Output` can also
+be used to pass collections down the pipeline as a single object with the **NoEnumerate** parameter.
## EXAMPLES ### Example 1: Get objects and write them to the console
+In this example, the results of the `Get-Process` cmdlet are stored in the `$P` variable. The
+`Write-Output` cmdlet displays the process objects in `$P` to the console.
+ ```powershell $P = Get-Process Write-Output $P ```
-The first command gets processes running on the computer and stores them in the `$P` variable.
-
-The second and third commands display the process objects in `$P` on the console.
- ### Example 2: Pass output to another cmdlet
+This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
+of the **System.String** class, demonstrating that the string was passed along the pipeline.
+ ```powershell Write-Output "test output" | Get-Member ```
-This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
-of the **System.String** class, demonstrating that the string was passed along the pipeline.
- ### Example 3: Suppress enumeration in output
+This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
+through the pipeline.
+ ```powershell Write-Output 1,2,3 | Measure-Object ```
Count : 1
... ```
-This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
-through the pipeline.
- ## PARAMETERS ### -InputObject
suppresses the default behavior, and prevents `Write-Output` from enumerating ou
**NoEnumerate** parameter has no effect if the command is wrapped in parentheses, because the parentheses force enumeration. For example, `(Write-Output 1,2,3)` still enumerates the array.
-> [!NOTE]
-> This switch only works correctly with PowerShell Core 6.2 and newer. On older versions of
-> PowerShell Core, the collection is still enumerated even with use of this switch.
+The **NoEnumerate** parameter is only useful within a pipeline. Trying to see the effects of
+**NoEnumerate** in the console is problematic because PowerShell adds `Out-Default` to the end of
+every command line, which results in enumeration. But if you pipe `Write-Output -NoEnumerate` to
+another cmdlet, the downstream cmdlet receives the collection object, not the enumerated items of
+the collection.
```yaml Type: System.Management.Automation.SwitchParameter
Microsoft.PowerShell.Utility Invoke Expression (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Invoke-Expression.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 04/08/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-Expression --- # Invoke-Expression
-## SYNOPSIS
+## Synopsis
Runs commands or expressions on the local computer.
-## SYNTAX
+## Syntax
``` Invoke-Expression [-Command] <String> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-Expression` cmdlet evaluates or runs a specified string as a command and returns the results of the expression or command. Without `Invoke-Expression`, a string submitted at the command
Expressions are evaluated and run in the current scope. For more information, se
> before running it. In general, it is best to design your script with predefined input options, > rather than allowing freeform input.
-## EXAMPLES
+## Examples
### Example 1: Evaluate an expression
would be replaced by its value before it was saved in the `$Command` variable.
### Example 4: Get and run a cmdlet Help example ```powershell
-$Cmdlet_name = "Get-EventLog"
+$Cmdlet_name = "Get-ComputerInfo"
$Example_number = 1 $Example_code = (Get-Help $Cmdlet_name).examples.example[($Example_number-1)].code Invoke-Expression $Example_code
To run an example of a different cmdlet, change the value of the `$Cmdlet_name`
of the cmdlet. And, change the `$Example_number` variable to the example number you want to run. The command fails if the example number is not valid.
-## PARAMETERS
+> [!NOTE]
+> If the example code from the help file has output in the example, PowerShell attempts to run the
+> output along with the code and an error will be thrown.
+
+## Parameters
### -Command
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String or PSObject You can pipe an object that represents the command to `Invoke-Expression`. Use the `$Input` automatic variable to represent the input objects in the command.
-## OUTPUTS
+## Outputs
### PSObject Returns the output that is generated by the invoked command (the value of the **Command** parameter).
-## NOTES
+## Notes
In most cases, you invoke expressions using PowerShell's call operator and achieve the same results. The call operator is a safer method. For more information, see [about_Operators](../microsoft.powershell.core/about/about_operators.md#call-operator-).
-## RELATED LINKS
+## Related links
[Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md)
Microsoft.PowerShell.Utility Invoke Webrequest (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
Beginning in PowerShell 7.0, `Invoke-WebRequest` supports proxy configuration de
variables. See the [Notes](#notes) section of this article. > [!IMPORTANT]
-> The examples in this article reference hosts in the `constoso.com` domain. This is a fictitious
+> The examples in this article reference hosts in the `contoso.com` domain. This is a fictitious
> domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets. > However, since the `contoso.com` sites do not exist, the examples do not work. Adapt the examples > to hosts in your environment.
Microsoft.PowerShell.Utility Write Output (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Write-Output.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 10/14/2020 Last updated : 08/10/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/write-output?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Write-Output
Title: Write-Output
# Write-Output ## SYNOPSIS
-Sends the specified objects to the next command in the pipeline. If the command is the last command
-in the pipeline, the objects are displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
## SYNTAX
Write-Output [-InputObject] <PSObject[]> [-NoEnumerate] [<CommonParameters>]
## DESCRIPTION
-The `Write-Output` cmdlet sends the specified object down the pipeline to the next command.
-If the command is the last command in the pipeline, the object is displayed in the console.
+Writes the specified objects to the pipeline. If `Write-Output` is the last command in the pipeline,
+the objects are displayed in the console.
-`Write-Output` sends objects down the primary pipeline, also known as the "output stream" or the
-"success pipeline." To send error objects down the error pipeline, use Write-Error.
+`Write-Output` sends objects to the primary pipeline, also known as the "output stream" or the
+"success pipeline." To send error objects to the error pipeline, use `Write-Error`.
This cmdlet is typically used in scripts to display strings and other objects on the console. One of
-the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`, the
+the built-in aliases for `Write-Output` is `echo` and similar to other shells that use `echo`. The
default behavior is to display the output at the end of a pipeline. In PowerShell, it is generally not necessary to use the cmdlet in instances where the output is displayed by default. For example, `Get-Process | Write-Output` is equivalent to `Get-Process`. Or, `echo "Home directory: $HOME"` can be written, `"Home directory: $HOME"`.
-By default, `Write-Output` enumerates through collections provided to the cmdlet. However,
-`Write-Output` can also be used to pass collections down the pipeline as a single object with the
-**NoEnumerate** parameter.
+By default, `Write-Output` enumerates through collection objects. However, `Write-Output` can also
+be used to pass collections down the pipeline as a single object with the **NoEnumerate** parameter.
## EXAMPLES ### Example 1: Get objects and write them to the console
+In this example, the results of the `Get-Process` cmdlet are stored in the `$P` variable. The
+`Write-Output` cmdlet displays the process objects in `$P` to the console.
+ ```powershell $P = Get-Process Write-Output $P ```
-The first command gets processes running on the computer and stores them in the `$P` variable.
-
-The second and third commands display the process objects in `$P` on the console.
- ### Example 2: Pass output to another cmdlet
+This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
+of the **System.String** class, demonstrating that the string was passed along the pipeline.
+ ```powershell Write-Output "test output" | Get-Member ```
-This command pipes the "test output" string to the `Get-Member` cmdlet, which displays the members
-of the **System.String** class, demonstrating that the string was passed along the pipeline.
- ### Example 3: Suppress enumeration in output
+This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
+through the pipeline.
+ ```powershell Write-Output 1,2,3 | Measure-Object ```
Count : 1
... ```
-This command adds the **NoEnumerate** parameter to treat a collection or array as a single object
-through the pipeline.
- ## PARAMETERS ### -InputObject
suppresses the default behavior, and prevents `Write-Output` from enumerating ou
**NoEnumerate** parameter has no effect if the command is wrapped in parentheses, because the parentheses force enumeration. For example, `(Write-Output 1,2,3)` still enumerates the array.
-> [!NOTE]
-> This switch only works correctly with PowerShell Core 6.2 and newer. On older versions of
-> PowerShell Core, the collection is still enumerated even with use of this switch.
+The **NoEnumerate** parameter is only useful within a pipeline. Trying to see the effects of
+**NoEnumerate** in the console is problematic because PowerShell adds `Out-Default` to the end of
+every command line, which results in enumeration. But if you pipe `Write-Output -NoEnumerate` to
+another cmdlet, the downstream cmdlet receives the collection object, not the enumerated items of
+the collection.
```yaml Type: System.Management.Automation.SwitchParameter
learn PS Remoting Second Hop https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/learn/remoting/PS-remoting-second-hop.md
Set-ADComputer -Identity $ServerC `
-PrincipalsAllowedToDelegateToAccount @($ServerB1,$ServerB2,$ServerB3) ```
-If you want to make the second hop across domains, add fully-qualified domain name (FQDN) of the
-domain controller of the domain to which _ServerB_ belongs:
+If you want to make the second hop across domains, use the **Server** parameter to specify
+fully-qualified domain name (FQDN) of the domain controller of the domain
+to which _ServerB_ belongs:
```powershell # For ServerC in Contoso domain and ServerB in other domain
Set-ADComputer -Identity $ServerC -PrincipalsAllowedToDelegateToAccount $null
## Kerberos delegation (unconstrained)
-You can also used Kerberos unconstrained delegation to make the second hop. Like all Kerberos
+You can also use Kerberos unconstrained delegation to make the second hop. Like all Kerberos
scenarios, credentials are not stored. This method does not support the second hop for WinRM. > [!WARNING]
whats-new Module Compatibility https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/docs-conceptual/whats-new/module-compatibility.md
description: This article lists the status of PowerShell 7 with Powershell modul
# PowerShell 7 module compatibility
-This article contains a list of PowerShell modules published by Microsoft. This modules provide
-management and support for various Microsoft products and services. These modules have been update
-to work natively with PowerShell 7 or tested for compatibility with PowerShell 7. This list will be
+This article contains a list of PowerShell modules published by Microsoft. These modules provide
+management and support for various Microsoft products and services. They have been updated
+to work natively with PowerShell 7, or tested for compatibility with PowerShell 7. This list will be
updated with new information as more modules are identified and tested. If you have information to share or issues with specific modules, please file an issue in the
If you have information to share or issues with specific modules, please file an
## Windows management modules
-The Windows management module are installed in different ways dependent on the Edition of Windows
+The Windows management modules are installed in different ways, dependent on the Edition of Windows,
and how the module was packaged for that Edition. On Windows Server, use the feature name with the [Install-WindowsFeature](/powershell/module/servermanager/install-windowsfeature)
administrator**.
### ServerManager module
-The module has some minor compatibility issues with formatted output in PowerShell 7. For example, the
+This module has some minor compatibility issues with formatted output in PowerShell 7. For example, the
`Get-WindowsFeature` cmdlet returns the proper object with all properties, but the default display formatting makes some properties appear to be empty. The actual values are available in the object properties using `Select-Object` or by direct member access.