Updates from: 06/26/2021 03:20:07
Service Microsoft Docs article Related commit history on GitHub Change details
CimCmdlets Get Cimassociatedinstance (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/CimCmdlets/Get-CimAssociatedInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-cimassociatedinstance?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimAssociatedInstance
Accept wildcard characters: False
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: (All)
CimCmdlets Get Ciminstance (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/CimCmdlets/Get-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 02/21/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-ciminstance?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimInstance
instance object as an input, `Get-CimInstance` returns the object from server us
operation, instead of an enumerate or query operation. Using a get CIM operation is more efficient than retrieving all instances and then filtering them.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ If the CIM class does not implement the get operation, then specifying the **InputObject** parameter returns an error.
CimCmdlets Remove Ciminstance (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/CimCmdlets/Remove-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 5/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/remove-ciminstance?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to be removed from the CIM server. The object passed to the cmdlet is not changed, only the instance in the CIM server is removed.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
CimCmdlets Set Ciminstance (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/CimCmdlets/Set-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 5/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/set-ciminstance?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Set-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to use as input.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
Microsoft.PowerShell.Core About Arrays (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md
--- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US Previously updated : 08/26/2020 Last updated : 06/25/2021 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0
Title: about Arrays
# about_Arrays ## Short Description
-Describes arrays, which are data structures designed to store
-collections of items.
+Describes arrays, which are data structures designed to store collections of
+items.
## Long Description
$a[-1]
4 ```
+## Member enumeration
+
+You can use member enumeration to get property values from all members of a
+collection. When you use the member access operator (`.`) with a member name on
+a collection object, such as an array, if the collection object does not have a
+member of that name, the items of the collection are enumerated and PowerShell
+looks for that member on each item. This applies to both property and method
+members.
+
+The following example creates two new files and stores the resulting objects in
+the array variable `$files`. Since the array object does not have the
+**LastWriteTime** member, the value of **LastWriteTime** is returned for each
+item in the array.
+
+```powershell
+$files = (New-Item -Type File -Force '/temp/t1.txt'),
+ (New-Item -Force -Type File '/temp/t2.txt')
+$files.LastWriteTime
+```
+
+```Output
+Friday, June 25, 2021 1:21:17 PM
+Friday, June 25, 2021 1:21:17 PM
+```
+
+Member enumeration can be used to _get_ values from items in a collection, but
+it cannot be used to _set_ values on items in a collection. For example:
+
+```powershell
+$files.LastWriteTime = (Get-Date).AddDays(-1)
+```
+
+```Output
+The property 'LastWriteTime' cannot be found on this object. Verify that the
+property exists and can be set.
+At line:1 char:1
++ $files.LastWriteTime = (Get-Date).AddDays(-1)++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ + CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ + FullyQualifiedErrorId : PropertyAssignmentException
+```
+
+To set the values you must use a method.
+
+```powershell
+$files.set_LastWriteTime((Get-Date).AddDays(-1))
+$files.LastWriteTime
+```
+
+```Output
+Thursday, June 24, 2021 1:23:30 PM
+Thursday, June 24, 2021 1:23:30 PM
+```
+
+The `set_LastWriteTime()` method is a _hidden_ member of the **FileInfo**
+object. The following example shows how to find members that have a _hidden_
+`set` method.
+
+```powershell
+$files | Get-Member | Where-Object Definition -like '*set;*'
+```
+
+```Output
+ TypeName: System.IO.FileInfo
+
+Name MemberType Definition
+---- ---------- ----------
+Attributes Property System.IO.FileAttributes Attributes {get;set;}
+CreationTime Property datetime CreationTime {get;set;}
+CreationTimeUtc Property datetime CreationTimeUtc {get;set;}
+IsReadOnly Property bool IsReadOnly {get;set;}
+LastAccessTime Property datetime LastAccessTime {get;set;}
+LastAccessTimeUtc Property datetime LastAccessTimeUtc {get;set;}
+LastWriteTime Property datetime LastWriteTime {get;set;}
+LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;}
+```
+
+> [!CAUTION]
+> Since the method is executed for each item in the collection, care should be
+> taken when calling methods using member enumeration.
+ ## See also - [about_Assignment_Operators](about_Assignment_Operators.md)
Microsoft.PowerShell.Core About Language Keywords (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/About/about_Language_Keywords.md
---
-description: Describes the keywords in the PowerShell scripting language.
-keywords: powershell,cmdlet
+description: Describes the keywords in the PowerShell scripting language.
Locale: en-US Previously updated : 10/06/2020 Last updated : 06/25/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Language Keywords --- # about_Language_Keywords
-## SHORT DESCRIPTION
+## Short description
Describes the keywords in the PowerShell scripting language.
-## LONG DESCRIPTION
-
-PowerShell has the following language keywords. For more
-information, see the about topic for the keyword and the information that
-follows the table.
-
-Keyword | Reference
-Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md)
-Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Class | [about_Classes](about_Classes.md)
-Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md)
-Data | [about_Data_Sections](about_Data_Sections.md)
-Define | Reserved for future use
-Do | [about_Do](about_Do.md), [about_While](about_While.md)
-DynamicParam| [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md)
-Else | [about_If](about_If.md)
-Elseif | [about_If](about_If.md)
-End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Enum | [about_Enum](about_Enum.md)
-Exit | [Described in this topic](#exit)
-Filter | [about_Functions](about_Functions.md)
-Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-For | [about_For](about_For.md)
-ForEach | [about_ForEach](about_ForEach.md)
-From | Reserved for future use
-Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Hidden | [about_Hidden](about_Hidden.md)
-If | [about_If](about_If.md)
-In | [about_ForEach](about_ForEach.md)
-InlineScript| [about_InlineScript](../../PSWorkflow/About/about_InlineScript.md)
-Param | [about_Functions](about_Functions.md)
-Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Return | [about_Return](about_Return.md)
-Static | [about_Classes](about_Classes.md)
-Switch | [about_Switch](about_Switch.md)
-Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Until | [about_Do](about_Do.md)
-Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md)
-Var | Reserved for future use
-While | [about_While](about_While.md), [about_Do](about_Do.md)
-
-Language Keywords
-
-### Begin
+## Long description
+
+PowerShell has the following language keywords. For more information, see the
+about topic for the keyword and the information that follows the table.
+
+| Keyword | Reference |
+| ------------ | ----------------------------------------------------------------------------------------------------------------- |
+| Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md) |
+| Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Class | [about_Classes](about_Classes.md) |
+| Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md) |
+| Data | [about_Data_Sections](about_Data_Sections.md) |
+| Define | Reserved for future use |
+| Do | [about_Do](about_Do.md), [about_While](about_While.md) |
+| DynamicParam | [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md) |
+| Else | [about_If](about_If.md) |
+| Elseif | [about_If](about_If.md) |
+| End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Enum | [about_Enum](about_Enum.md) |
+| Exit | [Described in this topic](#exit) |
+| Filter | [about_Functions](about_Functions.md) |
+| Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| For | [about_For](about_For.md) |
+| ForEach | [about_ForEach](about_ForEach.md) |
+| From | Reserved for future use |
+| Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Hidden | [about_Hidden](about_Hidden.md) |
+| If | [about_If](about_If.md) |
+| In | [about_ForEach](about_ForEach.md) |
+| Param | [about_Functions](about_Functions.md) |
+| Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Return | [about_Return](about_Return.md) |
+| Static | [about_Classes](about_Classes.md) |
+| Switch | [about_Switch](about_Switch.md) |
+| Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Until | [about_Do](about_Do.md) |
+| Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md) |
+| Var | Reserved for future use |
+| While | [about_While](about_While.md), [about_Do](about_Do.md) |
+
+The following keywords are used by PowerShell workflows:
+
+| Keyword | Reference |
+| ------------ | ---------------------------------------------------------------------------- |
+| InlineScript | [about_InlineScript](/powershell/module/psworkflow/about/about_inlinescript) |
+| Parallel | [about_Parallel](/powershell/module/psworkflow/about/about_Parallel) |
+| Sequence | [about_Sequence](/powershell/module/psworkflow/about/about_sequence) |
+| Workflow | [about_Workflows](/powershell/module/psworkflow/about/about_workflows) |
+
+For more information about workflows, see
+[Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
+
+## Begin
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Process`, and `End` keywords. The `Begin` statement list runs one time before any
-objects are received from the pipeline.
+`Process`, and `End` keywords. The `Begin` statement list runs one time before
+any objects are received from the pipeline.
Syntax:
function <name> {
} ```
-### Break
+## Break
Causes a script to exit a loop.
while (<condition>) {
} ```
-### Catch
+## Catch
-Specifies a statement list to run if an error occurs in the accompanying Try
+Specifies a statement list to run if an error occurs in the accompanying `Try`
statement list. An error type requires brackets. The second pair of brackets indicates that the error type is optional.
try {<statement list>}
catch [[<error type>]] {<statement list>} ```
-### Class
+## Class
Specifies a new class in PowerShell.
class <class-name> {
} ```
-### Continue
+## Continue
Causes a script to stop running a loop and to go back to the condition. If the condition is met, the script begins the loop again.
while (<condition>) {
} ```
-### Data
+## Data
In a script, defines a section that isolates data from the script logic. Can also include `If` statements and some limited commands.
Syntax:
data <variable> [-supportedCommand <cmdlet-name>] {<permitted content>} ```
-### Do
+## Do
Used with the `While` or `Until` keyword as a looping construct. PowerShell runs the statement list at least one time, unlike a loop that uses `While`.
Syntax for `Until`:
do {<statement list>} until (<condition>) ```
-### DynamicParam
+## DynamicParam
Specifies one part of the body of a function, along with the `Begin`, `Process`, and `End` keywords. Dynamic parameters are added at run time.
function <name> {
} ```
-### Else
+## Else
Used with the `If` keyword to specify the default statement list.
if (<condition>) {<statement list>}
else {<statement list>} ```
-### Elseif
+## Elseif
Used with the `If` and `Else` keywords to specify additional conditionals. The `Else` keyword is optional.
elseif (<condition>) {<statement list>}
else {<statement list>} ```
-### End
+## End
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Begin`, and `End` keywords. The `End` statement list runs one time after all the
-objects have been received from the pipeline.
+`Begin`, and `End` keywords. The `End` statement list runs one time after all
+the objects have been received from the pipeline.
Syntax:
function <name> {
} ```
-### Enum
+## Enum
-`enum` is used to declare an enumeration; a distinct type that consists of
-a set of named labels called the enumerator list.
+`enum` is used to declare an enumeration; a distinct type that consists of a
+set of named labels called the enumerator list.
Syntax:
enum <enum-name> {
} ```
-### Exit
+## Exit
Causes PowerShell to exit a script or a PowerShell instance.
the `exit` command. If the script has no `exit` statement, the exit code is
always `0` when the script completes without error or `1` when the script terminates from an unhandled exception.
-### Filter
+## Filter
Specifies a function in which the statement list runs one time for each input object. It has the same effect as a function that contains only a Process
Syntax:
filter <name> {<statement list>} ```
-### Finally
+## Finally
Defines a statement list that runs after statements that are associated with
-Try and Catch. A `Finally` statement list runs even if you press `CTRL+C` to leave
-a script or if you use the Exit keyword in the script.
+`Try` and `Catch`. A `Finally` statement list runs even if you press
+<kbd>CTRL</kbd>+<kbd>C</kbd> to leave a script or if you use the Exit keyword
+in the script.
Syntax:
catch [<error type>] {<statement list>}
finally {<statement list>} ```
-### For
+## For
Defines a loop by using a condition.
Syntax:
for (<initialize>; <condition>; <iterate>) { <statement list> } ```
-### ForEach
+## ForEach
Defines a loop by using each member of a collection.
Syntax:
ForEach (<item> in <collection>) { <statement list> } ```
-### From
+## From
Reserved for future use.
-### Function
+## Function
Creates a named statement list of reusable code. You can name the scope a
-function belongs to. And, you can specify one or more named parameters by
-using the `Param` keyword. Within the function statement list, you can include
+function belongs to. And, you can specify one or more named parameters by using
+the `Param` keyword. Within the function statement list, you can include
`DynamicParam`, `Begin`, `Process`, and `End` statement lists. Syntax:
function [<scope:>]<name> [([type]<$pname1>, [[type]<$pname2>])] {
} ```
-### If
+## If
Defines a conditional.
Syntax:
if (<condition>) {<statement list>} ```
-### Hidden
+## Hidden
Hides class members from the default results of the `Get-Member` cmdlet, and from IntelliSense and tab completion results.
Syntax:
Hidden [data type] $member_name ```
-### In
+## In
Used in a `ForEach` statement to create a loop that uses each member of a collection.
Syntax:
ForEach (<item> in <collection>){<statement list>} ```
-### InlineScript
-
-Runs workflow commands in a shared PowerShell session. This keyword is valid
-only in a PowerShell Workflow.
-
-Syntax:
-
-```Syntax
-workflow <verb>-<noun>
-{
- InlineScript
- {
- <Command/Expression>
- ...
-
- }
-}
-```
-
-The `InlineScript` keyword indicates an `InlineScript` activity, which runs
-commands in a shared standard (non-workflow) session. You can use the
-`InlineScript` keyword to run commands that are not otherwise valid in a
-workflow, and to run commands that share data. By default, the commands in an
-InlineScript script block run in a separate process.
-
-For more information, see [Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
-
-### Param
+## Param
Defines the parameters in a function.
function [<scope:>]<name> {
} ```
-### Process
+## Process
Specifies a part of the body of a function, along with the `DynamicParam`, `Begin`, and `End` keywords. When a `Process` statement list receives input from the pipeline, the `Process` statement list runs one time for each element
-from the pipeline. If the pipeline provides no objects, the `Process`
-statement list does not run. If the command is the first command in the
-pipeline, the `Process` statement list runs one time.
+from the pipeline. If the pipeline provides no objects, the `Process` statement
+list does not run. If the command is the first command in the pipeline, the
+`Process` statement list runs one time.
Syntax:
function <name> {
} ```
-### Return
+## Return
-Causes PowerShell to leave the current scope, such as a script or function,
-and writes the optional expression to the output.
+Causes PowerShell to leave the current scope, such as a script or function, and
+writes the optional expression to the output.
Syntax:
Syntax:
return [<expression>] ```
-### Static
+## Static
Specifies the property or method defined is common to all instances of the class in which is defined. See `Class` for usage examples.
-### Switch
+## Switch
-To check multiple conditions, use a `Switch` statement. The `Switch` statement is
-equivalent to a series of `If` statements, but it is simpler.
+To check multiple conditions, use a `Switch` statement. The `Switch` statement
+is equivalent to a series of `If` statements, but it is simpler.
The `Switch` statement lists each condition and an optional action. If a condition obtains, the action is performed.
switch [-regex|-wildcard|-exact][-casesensitive] -file <filename>
} ```
-### Throw
+## Throw
Throws an object as an error.
Syntax:
throw [<object>] ```
-### Trap
+## Trap
Defines a statement list to be run if an error is encountered. An error type requires brackets. The second pair of brackets indicates that the error type
Syntax:
trap [[<error type>]] {<statement list>} ```
-### Try
+## Try
Defines a statement list to be checked for errors while the statements run. If an error occurs, PowerShell continues running in a `Catch` or `Finally`
catch [[<error type>]] {<statement list>}
finally {<statement list>} ```
-### Until
+## Until
Used in a `Do` statement as a looping construct where the statement list is executed at least one time.
Syntax:
do {<statement list>} until (<condition>) ```
-### Using
+## Using
Allows to indicate which namespaces are used in the session. Classes and members require less typing to mention them. You can also include classes from
Syntax #2:
using module <module-name> ```
-### While
+## While
The `while` statement is a looping construct where the condition is tested before the statements are executed. If the condition is FALSE, then the
Do loop Syntax:
do {<statement list>} while (<condition>) ```
-## SEE ALSO
+## See also
- [about_Special_Characters](about_Special_Characters.md) - [about_Wildcards](about_Wildcards.md)
Microsoft.PowerShell.Utility Format Hex (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Format-Hex.md
external help file: Microsoft.PowerShell.Utility-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 01/17/2020 Last updated : 06/22/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/format-hex?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Format-Hex
Accept wildcard characters: False
### -InputObject
-Used for pipeline input. Pipeline input supports only certain scalar types and `[system.io.fileinfo]`
-instances for piping from `Get-ChildItem`.
+Specifies the objects to be formatted. Enter a variable that contains the objects or type a command
+or expression that gets the objects.
+
+Only certain scalar types and `[system.io.fileinfo]` are supported.
The supported scalar types are:
PowershellGet Install Module (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/PowershellGet/Install-Module.md
external help file: PSModule-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: PowerShellGet Previously updated : 08/03/2020 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-module?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Module
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
PowershellGet Install Script (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/PowershellGet/Install-Script.md
external help file: PSModule-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: PowerShellGet Previously updated : 06/09/2017 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-script?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Script
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
CimCmdlets Get Cimassociatedinstance (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/CimCmdlets/Get-CimAssociatedInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-cimassociatedinstance?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimAssociatedInstance
Accept wildcard characters: False
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: (All)
CimCmdlets Get Ciminstance (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/CimCmdlets/Get-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 02/21/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-ciminstance?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimInstance
instance object as an input, `Get-CimInstance` returns the object from server us
operation, instead of an enumerate or query operation. Using a get CIM operation is more efficient than retrieving all instances and then filtering them.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ If the CIM class does not implement the get operation, then specifying the **InputObject** parameter returns an error.
CimCmdlets Remove Ciminstance (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/CimCmdlets/Remove-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 5/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/remove-ciminstance?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to be removed from the CIM server. The object passed to the cmdlet is not changed, only the instance in the CIM server is removed.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
CimCmdlets Set Ciminstance (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/CimCmdlets/Set-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 5/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/set-ciminstance?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Set-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to use as input.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
Microsoft.PowerShell.Core About Arrays (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Arrays.md
--- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US Previously updated : 08/26/2020 Last updated : 06/25/2021 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0
Title: about Arrays
# about_Arrays ## Short Description
-Describes arrays, which are data structures designed to store
-collections of items.
+Describes arrays, which are data structures designed to store collections of
+items.
## Long Description
arrays of objects.
For more information, see [System.Tuple](/dotnet/api/system.tuple).
+## Member enumeration
+
+You can use member enumeration to get property values from all members of a
+collection. When you use the member access operator (`.`) with a member name on
+a collection object, such as an array, if the collection object does not have a
+member of that name, the items of the collection are enumerated and PowerShell
+looks for that member on each item. This applies to both property and method
+members.
+
+The following example creates two new files and stores the resulting objects in
+the array variable `$files`. Since the array object does not have the
+**LastWriteTime** member, the value of **LastWriteTime** is returned for each
+item in the array.
+
+```powershell
+$files = (New-Item -Type File -Force '/temp/t1.txt'),
+ (New-Item -Force -Type File '/temp/t2.txt')
+$files.LastWriteTime
+```
+
+```Output
+Friday, June 25, 2021 1:21:17 PM
+Friday, June 25, 2021 1:21:17 PM
+```
+
+Member enumeration can be used to _get_ values from items in a collection, but
+it cannot be used to _set_ values on items in a collection. For example:
+
+```powershell
+$files.LastWriteTime = (Get-Date).AddDays(-1)
+```
+
+```Output
+InvalidOperation: The property 'LastWriteTime' cannot be found on this object.
+Verify that the property exists and can be set.
+```
+
+To set the values you must use a method.
+
+```powershell
+$files.set_LastWriteTime((Get-Date).AddDays(-1))
+$files.LastWriteTime
+```
+
+```Output
+Thursday, June 24, 2021 1:23:30 PM
+Thursday, June 24, 2021 1:23:30 PM
+```
+
+The `set_LastWriteTime()` method is a _hidden_ member of the **FileInfo**
+object. The following example shows how to find members that have a _hidden_
+`set` method.
+
+```powershell
+$files | Get-Member | Where-Object Definition -like '*set;*'
+```
+
+```Output
+ TypeName: System.IO.FileInfo
+
+Name MemberType Definition
+---- ---------- ----------
+Attributes Property System.IO.FileAttributes Attributes {get;set;}
+CreationTime Property datetime CreationTime {get;set;}
+CreationTimeUtc Property datetime CreationTimeUtc {get;set;}
+IsReadOnly Property bool IsReadOnly {get;set;}
+LastAccessTime Property datetime LastAccessTime {get;set;}
+LastAccessTimeUtc Property datetime LastAccessTimeUtc {get;set;}
+LastWriteTime Property datetime LastWriteTime {get;set;}
+LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;}
+```
+
+> [!CAUTION]
+> Since the method is executed for each item in the collection, care should be
+> taken when calling methods using member enumeration.
+ ## See also - [about_Assignment_Operators](about_Assignment_Operators.md)
Microsoft.PowerShell.Core About Language Keywords (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/About/about_Language_Keywords.md
---
-description: Describes the keywords in the PowerShell scripting language.
-keywords: powershell,cmdlet
+description: Describes the keywords in the PowerShell scripting language.
Locale: en-US Previously updated : 10/06/2020 Last updated : 06/25/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Language Keywords --- # about_Language_Keywords
-## SHORT DESCRIPTION
+## Short description
Describes the keywords in the PowerShell scripting language.
-## LONG DESCRIPTION
-
-PowerShell has the following language keywords. For more
-information, see the about topic for the keyword and the information that
-follows the table.
-
-Keyword | Reference
-Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md)
-Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Class | [about_Classes](about_Classes.md)
-Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md)
-Data | [about_Data_Sections](about_Data_Sections.md)
-Define | Reserved for future use
-Do | [about_Do](about_Do.md), [about_While](about_While.md)
-DynamicParam| [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md)
-Else | [about_If](about_If.md)
-Elseif | [about_If](about_If.md)
-End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Enum | [about_Enum](about_Enum.md)
-Exit | [Described in this topic](#exit)
-Filter | [about_Functions](about_Functions.md)
-Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-For | [about_For](about_For.md)
-ForEach | [about_ForEach](about_ForEach.md)
-From | Reserved for future use
-Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Hidden | [about_Hidden](about_Hidden.md)
-If | [about_If](about_If.md)
-In | [about_ForEach](about_ForEach.md)
-Param | [about_Functions](about_Functions.md)
-Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Return | [about_Return](about_Return.md)
-Static | [about_Classes](about_Classes.md)
-Switch | [about_Switch](about_Switch.md)
-Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Until | [about_Do](about_Do.md)
-Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md)
-Var | Reserved for future use
-While | [about_While](about_While.md), [about_Do](about_Do.md)
-
-Language Keywords
-
-### Begin
+## Long description
+
+PowerShell has the following language keywords. For more information, see the
+about topic for the keyword and the information that follows the table.
+
+| Keyword | Reference |
+| ------------ | ----------------------------------------------------------------------------------------------------------------- |
+| Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md) |
+| Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Class | [about_Classes](about_Classes.md) |
+| Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md) |
+| Data | [about_Data_Sections](about_Data_Sections.md) |
+| Define | Reserved for future use |
+| Do | [about_Do](about_Do.md), [about_While](about_While.md) |
+| DynamicParam | [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md) |
+| Else | [about_If](about_If.md) |
+| Elseif | [about_If](about_If.md) |
+| End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Enum | [about_Enum](about_Enum.md) |
+| Exit | [Described in this topic](#exit) |
+| Filter | [about_Functions](about_Functions.md) |
+| Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| For | [about_For](about_For.md) |
+| ForEach | [about_ForEach](about_ForEach.md) |
+| From | Reserved for future use |
+| Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Hidden | [about_Hidden](about_Hidden.md) |
+| If | [about_If](about_If.md) |
+| In | [about_ForEach](about_ForEach.md) |
+| Param | [about_Functions](about_Functions.md) |
+| Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Return | [about_Return](about_Return.md) |
+| Static | [about_Classes](about_Classes.md) |
+| Switch | [about_Switch](about_Switch.md) |
+| Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Until | [about_Do](about_Do.md) |
+| Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md) |
+| Var | Reserved for future use |
+| While | [about_While](about_While.md), [about_Do](about_Do.md) |
+
+The following keywords are used by PowerShell workflows:
+
+- InlineScript
+- Parallel
+- Sequence
+- Workflow
+
+PowerShell workflows are only supported in PowerShell 5.1. For more information
+about workflows, see
+[Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
+
+## Begin
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Process`, and `End` keywords. The `Begin` statement list runs one time before any
-objects are received from the pipeline.
+`Process`, and `End` keywords. The `Begin` statement list runs one time before
+any objects are received from the pipeline.
Syntax:
function <name> {
} ```
-### Break
+## Break
Causes a script to exit a loop.
while (<condition>) {
} ```
-### Catch
+## Catch
-Specifies a statement list to run if an error occurs in the accompanying Try
+Specifies a statement list to run if an error occurs in the accompanying `Try`
statement list. An error type requires brackets. The second pair of brackets indicates that the error type is optional.
try {<statement list>}
catch [[<error type>]] {<statement list>} ```
-### Class
+## Class
Specifies a new class in PowerShell.
class <class-name> {
} ```
-### Continue
+## Continue
Causes a script to stop running a loop and to go back to the condition. If the condition is met, the script begins the loop again.
while (<condition>) {
} ```
-### Data
+## Data
In a script, defines a section that isolates data from the script logic. Can also include `If` statements and some limited commands.
Syntax:
data <variable> [-supportedCommand <cmdlet-name>] {<permitted content>} ```
-### Do
+## Do
Used with the `While` or `Until` keyword as a looping construct. PowerShell runs the statement list at least one time, unlike a loop that uses `While`.
Syntax for `Until`:
do {<statement list>} until (<condition>) ```
-### DynamicParam
+## DynamicParam
Specifies one part of the body of a function, along with the `Begin`, `Process`, and `End` keywords. Dynamic parameters are added at run time.
function <name> {
} ```
-### Else
+## Else
Used with the `If` keyword to specify the default statement list.
if (<condition>) {<statement list>}
else {<statement list>} ```
-### Elseif
+## Elseif
Used with the `If` and `Else` keywords to specify additional conditionals. The `Else` keyword is optional.
elseif (<condition>) {<statement list>}
else {<statement list>} ```
-### End
+## End
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Begin`, and `End` keywords. The `End` statement list runs one time after all the
-objects have been received from the pipeline.
+`Begin`, and `End` keywords. The `End` statement list runs one time after all
+the objects have been received from the pipeline.
Syntax:
function <name> {
} ```
-### Enum
+## Enum
-`enum` is used to declare an enumeration; a distinct type that consists of
-a set of named labels called the enumerator list.
+`enum` is used to declare an enumeration; a distinct type that consists of a
+set of named labels called the enumerator list.
Syntax:
enum <enum-name> {
} ```
-### Exit
+## Exit
Causes PowerShell to exit a script or a PowerShell instance.
itself should include instructions for handling any errors or exceptions that
occur while the script is running. You should only use the `exit` statement to indicate the post-execution status of the script.
-On Windows, any number between `[int]::MinValue` and `[int]::MaxValue` is allowed.
+On Windows, any number between `[int]::MinValue` and `[int]::MaxValue` is
+allowed.
On Unix, only positive numbers between `[byte]::MinValue` and `[byte]::MaxValue` are allowed. A negative number in the range of `-1` through
the `exit` command. If the script has no `exit` statement, the exit code is
always `0` when the script completes without error or `1` when the script terminates from an unhandled exception.
-### Filter
+## Filter
Specifies a function in which the statement list runs one time for each input object. It has the same effect as a function that contains only a Process
Syntax:
filter <name> {<statement list>} ```
-### Finally
+## Finally
Defines a statement list that runs after statements that are associated with
-Try and Catch. A `Finally` statement list runs even if you press `CTRL+C` to leave
-a script or if you use the Exit keyword in the script.
+`Try` and `Catch`. A `Finally` statement list runs even if you press
+<kbd>CTRL</kbd>+<kbd>C</kbd> to leave a script or if you use the Exit keyword
+in the script.
Syntax:
catch [<error type>] {<statement list>}
finally {<statement list>} ```
-### For
+## For
Defines a loop by using a condition.
Syntax:
for (<initialize>; <condition>; <iterate>) { <statement list> } ```
-### ForEach
+## ForEach
Defines a loop by using each member of a collection.
Syntax:
ForEach (<item> in <collection>) { <statement list> } ```
-### From
+## From
Reserved for future use.
-### Function
+## Function
Creates a named statement list of reusable code. You can name the scope a
-function belongs to. And, you can specify one or more named parameters by
-using the `Param` keyword. Within the function statement list, you can include
+function belongs to. And, you can specify one or more named parameters by using
+the `Param` keyword. Within the function statement list, you can include
`DynamicParam`, `Begin`, `Process`, and `End` statement lists. Syntax:
function [<scope:>]<name> [([type]<$pname1>, [[type]<$pname2>])] {
} ```
-### If
+## If
Defines a conditional.
Syntax:
if (<condition>) {<statement list>} ```
-### Hidden
+## Hidden
Hides class members from the default results of the `Get-Member` cmdlet, and from IntelliSense and tab completion results.
Syntax:
Hidden [data type] $member_name ```
-### In
+## In
Used in a `ForEach` statement to create a loop that uses each member of a collection.
Syntax:
ForEach (<item> in <collection>){<statement list>} ```
-### InlineScript
-
-Runs workflow commands in a shared PowerShell session. This keyword is valid
-only in a PowerShell Workflow.
-
-Syntax:
-
-```Syntax
-workflow <verb>-<noun>
-{
- InlineScript
- {
- <Command/Expression>
- ...
-
- }
-}
-```
-
-The `InlineScript` keyword indicates an `InlineScript` activity, which runs
-commands in a shared standard (non-workflow) session. You can use the
-`InlineScript` keyword to run commands that are not otherwise valid in a
-workflow, and to run commands that share data. By default, the commands in an
-InlineScript script block run in a separate process.
-
-For more information, see [Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
-
-### Param
+## Param
Defines the parameters in a function.
function [<scope:>]<name> {
} ```
-### Process
+## Process
Specifies a part of the body of a function, along with the `DynamicParam`, `Begin`, and `End` keywords. When a `Process` statement list receives input from the pipeline, the `Process` statement list runs one time for each element
-from the pipeline. If the pipeline provides no objects, the `Process`
-statement list does not run. If the command is the first command in the
-pipeline, the `Process` statement list runs one time.
+from the pipeline. If the pipeline provides no objects, the `Process` statement
+list does not run. If the command is the first command in the pipeline, the
+`Process` statement list runs one time.
Syntax:
function <name> {
} ```
-### Return
+## Return
-Causes PowerShell to leave the current scope, such as a script or function,
-and writes the optional expression to the output.
+Causes PowerShell to leave the current scope, such as a script or function, and
+writes the optional expression to the output.
Syntax:
Syntax:
return [<expression>] ```
-### Static
+## Static
Specifies the property or method defined is common to all instances of the class in which is defined. See `Class` for usage examples.
-### Switch
+## Switch
-To check multiple conditions, use a `Switch` statement. The `Switch` statement is
-equivalent to a series of `If` statements, but it is simpler.
+To check multiple conditions, use a `Switch` statement. The `Switch` statement
+is equivalent to a series of `If` statements, but it is simpler.
The `Switch` statement lists each condition and an optional action. If a condition obtains, the action is performed.
switch [-regex|-wildcard|-exact][-casesensitive] -file <filename>
} ```
-### Throw
+## Throw
Throws an object as an error.
Syntax:
throw [<object>] ```
-### Trap
+## Trap
Defines a statement list to be run if an error is encountered. An error type requires brackets. The second pair of brackets indicates that the error type
Syntax:
trap [[<error type>]] {<statement list>} ```
-### Try
+## Try
Defines a statement list to be checked for errors while the statements run. If an error occurs, PowerShell continues running in a `Catch` or `Finally`
catch [[<error type>]] {<statement list>}
finally {<statement list>} ```
-### Until
+## Until
Used in a `Do` statement as a looping construct where the statement list is executed at least one time.
Syntax:
do {<statement list>} until (<condition>) ```
-### Using
+## Using
Allows to indicate which namespaces are used in the session. Classes and members require less typing to mention them. You can also include classes from
Syntax #2:
using module <module-name> ```
-### While
+## While
The `while` statement is a looping construct where the condition is tested before the statements are executed. If the condition is FALSE, then the
Do loop Syntax:
do {<statement list>} while (<condition>) ```
-## SEE ALSO
+## See also
- [about_Special_Characters](about_Special_Characters.md) - [about_Wildcards](about_Wildcards.md)
Microsoft.PowerShell.Management Remove Service (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Management/Remove-Service.md
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/remove-service?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-Service
Get-Service -DisplayName "Test Service" | Remove-Service
Specifies **ServiceController** objects that represent the services to remove. Enter a variable that contains the objects, or type a command or expression that gets the objects.
+The **InputObject** parameter doesn't enumerate collections. If a collection is passed, an error is
+thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: System.ServiceProcess.ServiceController Parameter Sets: InputObject
Microsoft.PowerShell.Utility Format Hex (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Format-Hex.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 01/17/2020 Last updated : 06/22/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/format-hex?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Format-Hex
Accept wildcard characters: False
### -InputObject
-Used for pipeline input. Pipeline input supports only certain scalar types and `[system.io.fileinfo]`
-instances for piping from `Get-ChildItem`.
+Specifies the objects to be formatted. Enter a variable that contains the objects or type a command
+or expression that gets the objects.
+
+Only certain scalar types and `[system.io.fileinfo]` are supported.
The supported scalar types are:
PowerShellGet Install Module (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/PowerShellGet/Install-Module.md
external help file: PSModule-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: PowerShellGet Previously updated : 08/03/2020 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-module?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Module
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
PowerShellGet Install Script (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/PowerShellGet/Install-Script.md
external help file: PSModule-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: PowerShellGet Previously updated : 06/09/2017 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-script?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Script
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
CimCmdlets Get Cimassociatedinstance (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/CimCmdlets/Get-CimAssociatedInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-cimassociatedinstance?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimAssociatedInstance
Accept wildcard characters: False
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: (All)
CimCmdlets Get Ciminstance (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/CimCmdlets/Get-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 02/21/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-ciminstance?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimInstance
instance object as an input, `Get-CimInstance` returns the object from server us
operation, instead of an enumerate or query operation. Using a get CIM operation is more efficient than retrieving all instances and then filtering them.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ If the CIM class does not implement the get operation, then specifying the **InputObject** parameter returns an error.
CimCmdlets Remove Ciminstance (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/CimCmdlets/Remove-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 5/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/remove-ciminstance?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to be removed from the CIM server. The object passed to the cmdlet is not changed, only the instance in the CIM server is removed.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
CimCmdlets Set Ciminstance (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/CimCmdlets/Set-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: CimCmdlets Previously updated : 5/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/set-ciminstance?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Set-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to use as input.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
Microsoft.PowerShell.Core About Arrays (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Arrays.md
--- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US Previously updated : 08/26/2020 Last updated : 06/25/2021 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0
Title: about Arrays
# about_Arrays ## Short Description
-Describes arrays, which are data structures designed to store
-collections of items.
+Describes arrays, which are data structures designed to store collections of
+items.
## Long Description
arrays of objects.
For more information, see [System.Tuple](/dotnet/api/system.tuple).
+## Member enumeration
+
+You can use member enumeration to get property values from all members of a
+collection. When you use the member access operator (`.`) with a member name on
+a collection object, such as an array, if the collection object does not have a
+member of that name, the items of the collection are enumerated and PowerShell
+looks for that member on each item. This applies to both property and method
+members.
+
+The following example creates two new files and stores the resulting objects in
+the array variable `$files`. Since the array object does not have the
+**LastWriteTime** member, the value of **LastWriteTime** is returned for each
+item in the array.
+
+```powershell
+$files = (New-Item -Type File -Force '/temp/t1.txt'),
+ (New-Item -Force -Type File '/temp/t2.txt')
+$files.LastWriteTime
+```
+
+```Output
+Friday, June 25, 2021 1:21:17 PM
+Friday, June 25, 2021 1:21:17 PM
+```
+
+Member enumeration can be used to _get_ values from items in a collection, but
+it cannot be used to _set_ values on items in a collection. For example:
+
+```powershell
+$files.LastWriteTime = (Get-Date).AddDays(-1)
+```
+
+```Output
+InvalidOperation: The property 'LastWriteTime' cannot be found on this object.
+Verify that the property exists and can be set.
+```
+
+To set the values you must use a method.
+
+```powershell
+$files.set_LastWriteTime((Get-Date).AddDays(-1))
+$files.LastWriteTime
+```
+
+```Output
+Thursday, June 24, 2021 1:23:30 PM
+Thursday, June 24, 2021 1:23:30 PM
+```
+
+The `set_LastWriteTime()` method is a _hidden_ member of the **FileInfo**
+object. The following example shows how to find members that have a _hidden_
+`set` method.
+
+```powershell
+$files | Get-Member | Where-Object Definition -like '*set;*'
+```
+
+```Output
+ TypeName: System.IO.FileInfo
+
+Name MemberType Definition
+---- ---------- ----------
+Attributes Property System.IO.FileAttributes Attributes {get;set;}
+CreationTime Property datetime CreationTime {get;set;}
+CreationTimeUtc Property datetime CreationTimeUtc {get;set;}
+IsReadOnly Property bool IsReadOnly {get;set;}
+LastAccessTime Property datetime LastAccessTime {get;set;}
+LastAccessTimeUtc Property datetime LastAccessTimeUtc {get;set;}
+LastWriteTime Property datetime LastWriteTime {get;set;}
+LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;}
+```
+
+> [!CAUTION]
+> Since the method is executed for each item in the collection, care should be
+> taken when calling methods using member enumeration.
+ ## See also - [about_Assignment_Operators](about_Assignment_Operators.md)
Microsoft.PowerShell.Core About Language Keywords (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/About/about_Language_Keywords.md
---
-description: Describes the keywords in the PowerShell scripting language.
-keywords: powershell,cmdlet
+description: Describes the keywords in the PowerShell scripting language.
Locale: en-US Previously updated : 10/06/2020 Last updated : 06/25/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Language Keywords --- # about_Language_Keywords
-## SHORT DESCRIPTION
+## Short description
Describes the keywords in the PowerShell scripting language.
-## LONG DESCRIPTION
-
-PowerShell has the following language keywords. For more
-information, see the about topic for the keyword and the information that
-follows the table.
-
-Keyword | Reference
-Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md)
-Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Class | [about_Classes](about_Classes.md)
-Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md)
-Data | [about_Data_Sections](about_Data_Sections.md)
-Define | Reserved for future use
-Do | [about_Do](about_Do.md), [about_While](about_While.md)
-DynamicParam| [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md)
-Else | [about_If](about_If.md)
-Elseif | [about_If](about_If.md)
-End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Enum | [about_Enum](about_Enum.md)
-Exit | [Described in this topic](#exit)
-Filter | [about_Functions](about_Functions.md)
-Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-For | [about_For](about_For.md)
-ForEach | [about_ForEach](about_ForEach.md)
-From | Reserved for future use
-Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Hidden | [about_Hidden](about_Hidden.md)
-If | [about_If](about_If.md)
-In | [about_ForEach](about_ForEach.md)
-Param | [about_Functions](about_Functions.md)
-Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Return | [about_Return](about_Return.md)
-Static | [about_Classes](about_Classes.md)
-Switch | [about_Switch](about_Switch.md)
-Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Until | [about_Do](about_Do.md)
-Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md)
-Var | Reserved for future use
-While | [about_While](about_While.md), [about_Do](about_Do.md)
-
-Language Keywords
-
-### Begin
+## Long description
+
+PowerShell has the following language keywords. For more information, see the
+about topic for the keyword and the information that follows the table.
+
+| Keyword | Reference |
+| ------------ | ----------------------------------------------------------------------------------------------------------------- |
+| Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md) |
+| Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Class | [about_Classes](about_Classes.md) |
+| Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md) |
+| Data | [about_Data_Sections](about_Data_Sections.md) |
+| Define | Reserved for future use |
+| Do | [about_Do](about_Do.md), [about_While](about_While.md) |
+| DynamicParam | [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md) |
+| Else | [about_If](about_If.md) |
+| Elseif | [about_If](about_If.md) |
+| End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Enum | [about_Enum](about_Enum.md) |
+| Exit | [Described in this topic](#exit) |
+| Filter | [about_Functions](about_Functions.md) |
+| Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| For | [about_For](about_For.md) |
+| ForEach | [about_ForEach](about_ForEach.md) |
+| From | Reserved for future use |
+| Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Hidden | [about_Hidden](about_Hidden.md) |
+| If | [about_If](about_If.md) |
+| In | [about_ForEach](about_ForEach.md) |
+| Param | [about_Functions](about_Functions.md) |
+| Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Return | [about_Return](about_Return.md) |
+| Static | [about_Classes](about_Classes.md) |
+| Switch | [about_Switch](about_Switch.md) |
+| Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Until | [about_Do](about_Do.md) |
+| Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md) |
+| Var | Reserved for future use |
+| While | [about_While](about_While.md), [about_Do](about_Do.md) |
+
+The following keywords are used by PowerShell workflows:
+
+- InlineScript
+- Parallel
+- Sequence
+- Workflow
+
+PowerShell workflows are only supported in PowerShell 5.1. For more information
+about workflows, see
+[Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
+
+## Begin
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Process`, and `End` keywords. The `Begin` statement list runs one time before any
-objects are received from the pipeline.
+`Process`, and `End` keywords. The `Begin` statement list runs one time before
+any objects are received from the pipeline.
Syntax:
function <name> {
} ```
-### Break
+## Break
Causes a script to exit a loop.
while (<condition>) {
} ```
-### Catch
+## Catch
-Specifies a statement list to run if an error occurs in the accompanying Try
+Specifies a statement list to run if an error occurs in the accompanying `Try`
statement list. An error type requires brackets. The second pair of brackets indicates that the error type is optional.
try {<statement list>}
catch [[<error type>]] {<statement list>} ```
-### Class
+## Class
Specifies a new class in PowerShell.
class <class-name> {
} ```
-### Continue
+## Continue
Causes a script to stop running a loop and to go back to the condition. If the condition is met, the script begins the loop again.
while (<condition>) {
} ```
-### Data
+## Data
In a script, defines a section that isolates data from the script logic. Can also include `If` statements and some limited commands.
Syntax:
data <variable> [-supportedCommand <cmdlet-name>] {<permitted content>} ```
-### Do
+## Do
Used with the `While` or `Until` keyword as a looping construct. PowerShell runs the statement list at least one time, unlike a loop that uses `While`.
Syntax for `Until`:
do {<statement list>} until (<condition>) ```
-### DynamicParam
+## DynamicParam
Specifies one part of the body of a function, along with the `Begin`, `Process`, and `End` keywords. Dynamic parameters are added at run time.
function <name> {
} ```
-### Else
+## Else
Used with the `If` keyword to specify the default statement list.
if (<condition>) {<statement list>}
else {<statement list>} ```
-### Elseif
+## Elseif
Used with the `If` and `Else` keywords to specify additional conditionals. The `Else` keyword is optional.
elseif (<condition>) {<statement list>}
else {<statement list>} ```
-### End
+## End
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Begin`, and `End` keywords. The `End` statement list runs one time after all the
-objects have been received from the pipeline.
+`Begin`, and `End` keywords. The `End` statement list runs one time after all
+the objects have been received from the pipeline.
Syntax:
function <name> {
} ```
-### Enum
+## Enum
-`enum` is used to declare an enumeration; a distinct type that consists of
-a set of named labels called the enumerator list.
+`enum` is used to declare an enumeration; a distinct type that consists of a
+set of named labels called the enumerator list.
Syntax:
enum <enum-name> {
} ```
-### Exit
+## Exit
Causes PowerShell to exit a script or a PowerShell instance.
itself should include instructions for handling any errors or exceptions that
occur while the script is running. You should only use the `exit` statement to indicate the post-execution status of the script.
-On Windows, any number between `[int]::MinValue` and `[int]::MaxValue` is allowed.
+On Windows, any number between `[int]::MinValue` and `[int]::MaxValue` is
+allowed.
On Unix, only positive numbers between `[byte]::MinValue` and `[byte]::MaxValue` are allowed. A negative number in the range of `-1` through
the `exit` command. If the script has no `exit` statement, the exit code is
always `0` when the script completes without error or `1` when the script terminates from an unhandled exception.
-### Filter
+## Filter
Specifies a function in which the statement list runs one time for each input object. It has the same effect as a function that contains only a Process
Syntax:
filter <name> {<statement list>} ```
-### Finally
+## Finally
Defines a statement list that runs after statements that are associated with
-Try and Catch. A `Finally` statement list runs even if you press `CTRL+C` to leave
-a script or if you use the Exit keyword in the script.
+`Try` and `Catch`. A `Finally` statement list runs even if you press
+<kbd>CTRL</kbd>+<kbd>C</kbd> to leave a script or if you use the Exit keyword
+in the script.
Syntax:
catch [<error type>] {<statement list>}
finally {<statement list>} ```
-### For
+## For
Defines a loop by using a condition.
Syntax:
for (<initialize>; <condition>; <iterate>) { <statement list> } ```
-### ForEach
+## ForEach
Defines a loop by using each member of a collection.
Syntax:
ForEach (<item> in <collection>) { <statement list> } ```
-### From
+## From
Reserved for future use.
-### Function
+## Function
Creates a named statement list of reusable code. You can name the scope a
-function belongs to. And, you can specify one or more named parameters by
-using the `Param` keyword. Within the function statement list, you can include
+function belongs to. And, you can specify one or more named parameters by using
+the `Param` keyword. Within the function statement list, you can include
`DynamicParam`, `Begin`, `Process`, and `End` statement lists. Syntax:
function [<scope:>]<name> [([type]<$pname1>, [[type]<$pname2>])] {
} ```
-### If
+## If
Defines a conditional.
Syntax:
if (<condition>) {<statement list>} ```
-### Hidden
+## Hidden
Hides class members from the default results of the `Get-Member` cmdlet, and from IntelliSense and tab completion results.
Syntax:
Hidden [data type] $member_name ```
-### In
+## In
Used in a `ForEach` statement to create a loop that uses each member of a collection.
Syntax:
ForEach (<item> in <collection>){<statement list>} ```
-### InlineScript
-
-Runs workflow commands in a shared PowerShell session. This keyword is valid
-only in a PowerShell Workflow.
-
-Syntax:
-
-```Syntax
-workflow <verb>-<noun>
-{
- InlineScript
- {
- <Command/Expression>
- ...
-
- }
-}
-```
-
-The `InlineScript` keyword indicates an `InlineScript` activity, which runs
-commands in a shared standard (non-workflow) session. You can use the
-`InlineScript` keyword to run commands that are not otherwise valid in a
-workflow, and to run commands that share data. By default, the commands in an
-InlineScript script block run in a separate process.
-
-For more information, see [Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
-
-### Param
+## Param
Defines the parameters in a function.
function [<scope:>]<name> {
} ```
-### Process
+## Process
Specifies a part of the body of a function, along with the `DynamicParam`, `Begin`, and `End` keywords. When a `Process` statement list receives input from the pipeline, the `Process` statement list runs one time for each element
-from the pipeline. If the pipeline provides no objects, the `Process`
-statement list does not run. If the command is the first command in the
-pipeline, the `Process` statement list runs one time.
+from the pipeline. If the pipeline provides no objects, the `Process` statement
+list does not run. If the command is the first command in the pipeline, the
+`Process` statement list runs one time.
Syntax:
function <name> {
} ```
-### Return
+## Return
-Causes PowerShell to leave the current scope, such as a script or function,
-and writes the optional expression to the output.
+Causes PowerShell to leave the current scope, such as a script or function, and
+writes the optional expression to the output.
Syntax:
Syntax:
return [<expression>] ```
-### Static
+## Static
Specifies the property or method defined is common to all instances of the class in which is defined. See `Class` for usage examples.
-### Switch
+## Switch
-To check multiple conditions, use a `Switch` statement. The `Switch` statement is
-equivalent to a series of `If` statements, but it is simpler.
+To check multiple conditions, use a `Switch` statement. The `Switch` statement
+is equivalent to a series of `If` statements, but it is simpler.
The `Switch` statement lists each condition and an optional action. If a condition obtains, the action is performed.
switch [-regex|-wildcard|-exact][-casesensitive] -file <filename>
} ```
-### Throw
+## Throw
Throws an object as an error.
Syntax:
throw [<object>] ```
-### Trap
+## Trap
Defines a statement list to be run if an error is encountered. An error type requires brackets. The second pair of brackets indicates that the error type
Syntax:
trap [[<error type>]] {<statement list>} ```
-### Try
+## Try
Defines a statement list to be checked for errors while the statements run. If an error occurs, PowerShell continues running in a `Catch` or `Finally`
catch [[<error type>]] {<statement list>}
finally {<statement list>} ```
-### Until
+## Until
Used in a `Do` statement as a looping construct where the statement list is executed at least one time.
Syntax:
do {<statement list>} until (<condition>) ```
-### Using
+## Using
Allows to indicate which namespaces are used in the session. Classes and members require less typing to mention them. You can also include classes from
Syntax #2:
using module <module-name> ```
-### While
+## While
The `while` statement is a looping construct where the condition is tested before the statements are executed. If the condition is FALSE, then the
Do loop Syntax:
do {<statement list>} while (<condition>) ```
-## SEE ALSO
+## See also
- [about_Special_Characters](about_Special_Characters.md) - [about_Wildcards](about_Wildcards.md)-
Microsoft.PowerShell.Management Remove Service (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Management/Remove-Service.md
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/remove-service?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-Service
Get-Service -DisplayName "Test Service" | Remove-Service
Specifies **ServiceController** objects that represent the services to remove. Enter a variable that contains the objects, or type a command or expression that gets the objects.
+The **InputObject** parameter doesn't enumerate collections. If a collection is passed, an error is
+thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: System.ServiceProcess.ServiceController Parameter Sets: InputObject
Microsoft.PowerShell.Utility Format Hex (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Format-Hex.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 08/19/2020 Last updated : 06/22/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/format-hex?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Format-Hex
Accept wildcard characters: False
### -InputObject
-Used for pipeline input. Pipeline input supports only certain scalar types and `[system.io.fileinfo]`
-instances for piping from `Get-ChildItem`.
+Specifies the objects to be formatted. Enter a variable that contains the objects or type a command
+or expression that gets the objects.
+
+Only certain scalar types and `[system.io.fileinfo]` are supported.
The supported scalar types are:
PowerShellGet Install Module (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/PowerShellGet/Install-Module.md
external help file: PSModule-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: PowerShellGet Previously updated : 08/03/2020 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-module?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Module
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
PowerShellGet Install Script (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/PowerShellGet/Install-Script.md
external help file: PSModule-help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: PowerShellGet Previously updated : 06/09/2017 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-script?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Script
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
CimCmdlets Get Cimassociatedinstance (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/CimCmdlets/Get-CimAssociatedInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml Locale: en-US Module Name: CimCmdlets Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-cimassociatedinstance?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimAssociatedInstance
Accept wildcard characters: False
Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: (All)
CimCmdlets Get Ciminstance (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/CimCmdlets/Get-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml Locale: en-US Module Name: CimCmdlets Previously updated : 02/21/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/get-ciminstance?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-CimInstance
instance object as an input, `Get-CimInstance` returns the object from server us
operation, instead of an enumerate or query operation. Using a get CIM operation is more efficient than retrieving all instances and then filtering them.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ If the CIM class does not implement the get operation, then specifying the **InputObject** parameter returns an error.
CimCmdlets Remove Ciminstance (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/CimCmdlets/Remove-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml Locale: en-US Module Name: CimCmdlets Previously updated : 05/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/remove-ciminstance?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to be removed from the CIM server. The object passed to the cmdlet is not changed, only the instance in the CIM server is removed.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
CimCmdlets Set Ciminstance (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/CimCmdlets/Set-CimInstance.md
external help file: Microsoft.Management.Infrastructure.CimCmdlets.dll-Help.xml Locale: en-US Module Name: CimCmdlets Previously updated : 05/15/2019 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/cimcmdlets/set-ciminstance?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Set-CimInstance
Accept wildcard characters: False
Specifies a CIM instance object to use as input.
+The **InputObject** parameter doesn't enumerate over collections. If a collection is passed, an
+error is thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: Microsoft.Management.Infrastructure.CimInstance Parameter Sets: CimInstanceComputerSet, CimInstanceSessionSet
Microsoft.PowerShell.Core About Arrays (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Arrays.md
--- description: Describes arrays, which are data structures designed to store collections of items. Locale: en-US Previously updated : 08/26/2020 Last updated : 06/25/2021 no-loc: [Count, Length, LongLength, Rank, ForEach, Clear, Default, First, Last, SkipUntil, Until, Split, Tuple] online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0
Title: about Arrays
# about_Arrays ## Short Description
-Describes arrays, which are data structures designed to store
-collections of items.
+Describes arrays, which are data structures designed to store collections of
+items.
## Long Description
arrays of objects.
For more information, see [System.Tuple](/dotnet/api/system.tuple).
+## Member enumeration
+
+You can use member enumeration to get property values from all members of a
+collection. When you use the member access operator (`.`) with a member name on
+a collection object, such as an array, if the collection object does not have a
+member of that name, the items of the collection are enumerated and PowerShell
+looks for that member on each item. This applies to both property and method
+members.
+
+The following example creates two new files and stores the resulting objects in
+the array variable `$files`. Since the array object does not have the
+**LastWriteTime** member, the value of **LastWriteTime** is returned for each
+item in the array.
+
+```powershell
+$files = (New-Item -Type File -Force '/temp/t1.txt'),
+ (New-Item -Force -Type File '/temp/t2.txt')
+$files.LastWriteTime
+```
+
+```Output
+Friday, June 25, 2021 1:21:17 PM
+Friday, June 25, 2021 1:21:17 PM
+```
+
+Member enumeration can be used to _get_ values from items in a collection, but
+it cannot be used to _set_ values on items in a collection. For example:
+
+```powershell
+$files.LastWriteTime = (Get-Date).AddDays(-1)
+```
+
+```Output
+InvalidOperation: The property 'LastWriteTime' cannot be found on this object.
+Verify that the property exists and can be set.
+```
+
+To set the values you must use a method.
+
+```powershell
+$files.set_LastWriteTime((Get-Date).AddDays(-1))
+$files.LastWriteTime
+```
+
+```Output
+Thursday, June 24, 2021 1:23:30 PM
+Thursday, June 24, 2021 1:23:30 PM
+```
+
+The `set_LastWriteTime()` method is a _hidden_ member of the **FileInfo**
+object. The following example shows how to find members that have a _hidden_
+`set` method.
+
+```powershell
+$files | Get-Member | Where-Object Definition -like '*set;*'
+```
+
+```Output
+ TypeName: System.IO.FileInfo
+
+Name MemberType Definition
+---- ---------- ----------
+Attributes Property System.IO.FileAttributes Attributes {get;set;}
+CreationTime Property datetime CreationTime {get;set;}
+CreationTimeUtc Property datetime CreationTimeUtc {get;set;}
+IsReadOnly Property bool IsReadOnly {get;set;}
+LastAccessTime Property datetime LastAccessTime {get;set;}
+LastAccessTimeUtc Property datetime LastAccessTimeUtc {get;set;}
+LastWriteTime Property datetime LastWriteTime {get;set;}
+LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;}
+```
+
+> [!CAUTION]
+> Since the method is executed for each item in the collection, care should be
+> taken when calling methods using member enumeration.
+ ## See also - [about_Assignment_Operators](about_Assignment_Operators.md)
Microsoft.PowerShell.Core About Language Keywords (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/About/about_Language_Keywords.md
--- description: Describes the keywords in the PowerShell scripting language. Locale: en-US Previously updated : 10/06/2020 Last updated : 06/25/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: about Language Keywords --- # about_Language_Keywords
-## SHORT DESCRIPTION
+## Short description
Describes the keywords in the PowerShell scripting language.
-## LONG DESCRIPTION
-
-PowerShell has the following language keywords. For more
-information, see the about topic for the keyword and the information that
-follows the table.
-
-Keyword | Reference
-Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md)
-Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Class | [about_Classes](about_Classes.md)
-Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md)
-Data | [about_Data_Sections](about_Data_Sections.md)
-Define | Reserved for future use
-Do | [about_Do](about_Do.md), [about_While](about_While.md)
-DynamicParam| [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md)
-Else | [about_If](about_If.md)
-Elseif | [about_If](about_If.md)
-End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Enum | [about_Enum](about_Enum.md)
-Exit | [Described in this topic](#exit)
-Filter | [about_Functions](about_Functions.md)
-Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-For | [about_For](about_For.md)
-ForEach | [about_ForEach](about_ForEach.md)
-From | Reserved for future use
-Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Hidden | [about_Hidden](about_Hidden.md)
-If | [about_If](about_If.md)
-In | [about_ForEach](about_ForEach.md)
-Param | [about_Functions](about_Functions.md)
-Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md)
-Return | [about_Return](about_Return.md)
-Static | [about_Classes](about_Classes.md)
-Switch | [about_Switch](about_Switch.md)
-Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md)
-Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md)
-Until | [about_Do](about_Do.md)
-Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md)
-Var | Reserved for future use
-While | [about_While](about_While.md), [about_Do](about_Do.md)
-
-Language Keywords
-
-### Begin
+## Long description
+
+PowerShell has the following language keywords. For more information, see the
+about topic for the keyword and the information that follows the table.
+
+| Keyword | Reference |
+| ------------ | ----------------------------------------------------------------------------------------------------------------- |
+| Begin | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Break | [about_Break](about_Break.md), [about_Trap](about_Trap.md) |
+| Catch | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Class | [about_Classes](about_Classes.md) |
+| Continue | [about_Continue](about_Continue.md), [about_Trap](about_Trap.md) |
+| Data | [about_Data_Sections](about_Data_Sections.md) |
+| Define | Reserved for future use |
+| Do | [about_Do](about_Do.md), [about_While](about_While.md) |
+| DynamicParam | [about_Functions_Advanced_Parameters](about_Functions_Advanced_Parameters.md) |
+| Else | [about_If](about_If.md) |
+| Elseif | [about_If](about_If.md) |
+| End | [about_Functions](about_Functions.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Enum | [about_Enum](about_Enum.md) |
+| Exit | [Described in this topic](#exit) |
+| Filter | [about_Functions](about_Functions.md) |
+| Finally | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| For | [about_For](about_For.md) |
+| ForEach | [about_ForEach](about_ForEach.md) |
+| From | Reserved for future use |
+| Function | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Hidden | [about_Hidden](about_Hidden.md) |
+| If | [about_If](about_If.md) |
+| In | [about_ForEach](about_ForEach.md) |
+| Param | [about_Functions](about_Functions.md) |
+| Process | [about_Functions](about_Functions.md), [about_Functions_Advanced](about_Functions_Advanced.md) |
+| Return | [about_Return](about_Return.md) |
+| Static | [about_Classes](about_Classes.md) |
+| Switch | [about_Switch](about_Switch.md) |
+| Throw | [about_Throw](about_Throw.md), [about_Functions_Advanced_Methods](about_Functions_Advanced_Methods.md) |
+| Trap | [about_Trap](about_Trap.md), [about_Break](about_Break.md), [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Try | [about_Try_Catch_Finally](about_Try_Catch_Finally.md) |
+| Until | [about_Do](about_Do.md) |
+| Using | [about_Using](about_Using.md), [about_Classes](about_Classes.md) |
+| Var | Reserved for future use |
+| While | [about_While](about_While.md), [about_Do](about_Do.md) |
+
+The following keywords are used by PowerShell workflows:
+
+- InlineScript
+- Parallel
+- Sequence
+- Workflow
+
+PowerShell workflows are only supported in PowerShell 5.1. For more information
+about workflows, see
+[Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
+
+## Begin
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Process`, and `End` keywords. The `Begin` statement list runs one time before any
-objects are received from the pipeline.
+`Process`, and `End` keywords. The `Begin` statement list runs one time before
+any objects are received from the pipeline.
Syntax:
function <name> {
} ```
-### Break
+## Break
Causes a script to exit a loop.
while (<condition>) {
} ```
-### Catch
+## Catch
-Specifies a statement list to run if an error occurs in the accompanying Try
+Specifies a statement list to run if an error occurs in the accompanying `Try`
statement list. An error type requires brackets. The second pair of brackets indicates that the error type is optional.
try {<statement list>}
catch [[<error type>]] {<statement list>} ```
-### Class
+## Class
Specifies a new class in PowerShell.
class <class-name> {
} ```
-### Continue
+## Continue
Causes a script to stop running a loop and to go back to the condition. If the condition is met, the script begins the loop again.
while (<condition>) {
} ```
-### Data
+## Data
In a script, defines a section that isolates data from the script logic. Can also include `If` statements and some limited commands.
Syntax:
data <variable> [-supportedCommand <cmdlet-name>] {<permitted content>} ```
-### Do
+## Do
Used with the `While` or `Until` keyword as a looping construct. PowerShell runs the statement list at least one time, unlike a loop that uses `While`.
Syntax for `Until`:
do {<statement list>} until (<condition>) ```
-### DynamicParam
+## DynamicParam
Specifies one part of the body of a function, along with the `Begin`, `Process`, and `End` keywords. Dynamic parameters are added at run time.
function <name> {
} ```
-### Else
+## Else
Used with the `If` keyword to specify the default statement list.
if (<condition>) {<statement list>}
else {<statement list>} ```
-### Elseif
+## Elseif
Used with the `If` and `Else` keywords to specify additional conditionals. The `Else` keyword is optional.
elseif (<condition>) {<statement list>}
else {<statement list>} ```
-### End
+## End
Specifies one part of the body of a function, along with the `DynamicParam`,
-`Begin`, and `End` keywords. The `End` statement list runs one time after all the
-objects have been received from the pipeline.
+`Begin`, and `End` keywords. The `End` statement list runs one time after all
+the objects have been received from the pipeline.
Syntax:
function <name> {
} ```
-### Enum
+## Enum
-`enum` is used to declare an enumeration; a distinct type that consists of
-a set of named labels called the enumerator list.
+`enum` is used to declare an enumeration; a distinct type that consists of a
+set of named labels called the enumerator list.
Syntax:
enum <enum-name> {
} ```
-### Exit
+## Exit
Causes PowerShell to exit a script or a PowerShell instance.
itself should include instructions for handling any errors or exceptions that
occur while the script is running. You should only use the `exit` statement to indicate the post-execution status of the script.
-On Windows, any number between `[int]::MinValue` and `[int]::MaxValue` is allowed.
+On Windows, any number between `[int]::MinValue` and `[int]::MaxValue` is
+allowed.
On Unix, only positive numbers between `[byte]::MinValue` and `[byte]::MaxValue` are allowed. A negative number in the range of `-1` through
the `exit` command. If the script has no `exit` statement, the exit code is
always `0` when the script completes without error or `1` when the script terminates from an unhandled exception.
-### Filter
+## Filter
Specifies a function in which the statement list runs one time for each input object. It has the same effect as a function that contains only a Process
Syntax:
filter <name> {<statement list>} ```
-### Finally
+## Finally
Defines a statement list that runs after statements that are associated with
-Try and Catch. A `Finally` statement list runs even if you press `CTRL+C` to leave
-a script or if you use the Exit keyword in the script.
+`Try` and `Catch`. A `Finally` statement list runs even if you press
+<kbd>CTRL</kbd>+<kbd>C</kbd> to leave a script or if you use the Exit keyword
+in the script.
Syntax:
catch [<error type>] {<statement list>}
finally {<statement list>} ```
-### For
+## For
Defines a loop by using a condition.
Syntax:
for (<initialize>; <condition>; <iterate>) { <statement list> } ```
-### ForEach
+## ForEach
Defines a loop by using each member of a collection.
Syntax:
ForEach (<item> in <collection>) { <statement list> } ```
-### From
+## From
Reserved for future use.
-### Function
+## Function
Creates a named statement list of reusable code. You can name the scope a
-function belongs to. And, you can specify one or more named parameters by
-using the `Param` keyword. Within the function statement list, you can include
+function belongs to. And, you can specify one or more named parameters by using
+the `Param` keyword. Within the function statement list, you can include
`DynamicParam`, `Begin`, `Process`, and `End` statement lists. Syntax:
function [<scope:>]<name> [([type]<$pname1>, [[type]<$pname2>])] {
} ```
-### If
+## If
Defines a conditional.
Syntax:
if (<condition>) {<statement list>} ```
-### Hidden
+## Hidden
Hides class members from the default results of the `Get-Member` cmdlet, and from IntelliSense and tab completion results.
Syntax:
Hidden [data type] $member_name ```
-### In
+## In
Used in a `ForEach` statement to create a loop that uses each member of a collection.
Syntax:
ForEach (<item> in <collection>){<statement list>} ```
-### InlineScript
-
-Runs workflow commands in a shared PowerShell session. This keyword is valid
-only in a PowerShell Workflow.
-
-Syntax:
-
-```Syntax
-workflow <verb>-<noun>
-{
- InlineScript
- {
- <Command/Expression>
- ...
-
- }
-}
-```
-
-The `InlineScript` keyword indicates an `InlineScript` activity, which runs
-commands in a shared standard (non-workflow) session. You can use the
-`InlineScript` keyword to run commands that are not otherwise valid in a
-workflow, and to run commands that share data. By default, the commands in an
-InlineScript script block run in a separate process.
-
-For more information, see [Running PowerShell Commands in a Workflow](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574197(v=ws.11)).
-
-### Param
+## Param
Defines the parameters in a function.
function [<scope:>]<name> {
} ```
-### Process
+## Process
Specifies a part of the body of a function, along with the `DynamicParam`, `Begin`, and `End` keywords. When a `Process` statement list receives input from the pipeline, the `Process` statement list runs one time for each element
-from the pipeline. If the pipeline provides no objects, the `Process`
-statement list does not run. If the command is the first command in the
-pipeline, the `Process` statement list runs one time.
+from the pipeline. If the pipeline provides no objects, the `Process` statement
+list does not run. If the command is the first command in the pipeline, the
+`Process` statement list runs one time.
Syntax:
function <name> {
} ```
-### Return
+## Return
-Causes PowerShell to leave the current scope, such as a script or function,
-and writes the optional expression to the output.
+Causes PowerShell to leave the current scope, such as a script or function, and
+writes the optional expression to the output.
Syntax:
Syntax:
return [<expression>] ```
-### Static
+## Static
Specifies the property or method defined is common to all instances of the class in which is defined. See `Class` for usage examples.
-### Switch
+## Switch
-To check multiple conditions, use a `Switch` statement. The `Switch` statement is
-equivalent to a series of `If` statements, but it is simpler.
+To check multiple conditions, use a `Switch` statement. The `Switch` statement
+is equivalent to a series of `If` statements, but it is simpler.
The `Switch` statement lists each condition and an optional action. If a condition obtains, the action is performed.
switch [-regex|-wildcard|-exact][-casesensitive] -file <filename>
} ```
-### Throw
+## Throw
Throws an object as an error.
Syntax:
throw [<object>] ```
-### Trap
+## Trap
Defines a statement list to be run if an error is encountered. An error type requires brackets. The second pair of brackets indicates that the error type
Syntax:
trap [[<error type>]] {<statement list>} ```
-### Try
+## Try
Defines a statement list to be checked for errors while the statements run. If an error occurs, PowerShell continues running in a `Catch` or `Finally`
catch [[<error type>]] {<statement list>}
finally {<statement list>} ```
-### Until
+## Until
Used in a `Do` statement as a looping construct where the statement list is executed at least one time.
Syntax:
do {<statement list>} until (<condition>) ```
-### Using
+## Using
Allows to indicate which namespaces are used in the session. Classes and members require less typing to mention them. You can also include classes from
Syntax #2:
using module <module-name> ```
-### While
+## While
The `while` statement is a looping construct where the condition is tested before the statements are executed. If the condition is FALSE, then the
Do loop Syntax:
do {<statement list>} while (<condition>) ```
-## SEE ALSO
+## See also
- [about_Special_Characters](about_Special_Characters.md) - [about_Wildcards](about_Wildcards.md)-
Microsoft.PowerShell.Management Remove Service (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Management/Remove-Service.md
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/21/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/remove-service?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Remove-Service
Get-Service -DisplayName "Test Service" | Remove-Service
Specifies **ServiceController** objects that represent the services to remove. Enter a variable that contains the objects, or type a command or expression that gets the objects.
+The **InputObject** parameter doesn't enumerate collections. If a collection is passed, an error is
+thrown. When working with collections, pipe the input to enumerate the values.
+ ```yaml Type: System.ServiceProcess.ServiceController Parameter Sets: InputObject
Microsoft.PowerShell.Utility Format Hex (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Format-Hex.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 08/19/2020 Last updated : 06/22/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/format-hex?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Format-Hex
Accept wildcard characters: False
### -InputObject
-Used for pipeline input. Pipeline input supports only certain scalar types and `[system.io.fileinfo]`
-instances for piping from `Get-ChildItem`.
+Specifies the objects to be formatted. Enter a variable that contains the objects or type a command
+or expression that gets the objects.
+
+Only certain scalar types and `[system.io.fileinfo]` are supported.
The supported scalar types are:
PowerShellGet Install Module (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/PowerShellGet/Install-Module.md
external help file: PSModule-help.xml Locale: en-US Module Name: PowerShellGet Previously updated : 08/03/2020 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-module?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Module
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]
PowerShellGet Install Script (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/PowerShellGet/Install-Script.md
external help file: PSModule-help.xml Locale: en-US Module Name: PowerShellGet Previously updated : 06/09/2017 Last updated : 06/23/2021 online version: https://docs.microsoft.com/powershell/module/powershellget/install-script?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Install-Script
Accept wildcard characters: False
### -InputObject
-Used for pipeline input.
+Used for pipeline input. An error is thrown if a value supplied directly to **InputObject**.
+Use the pipeline to pass objects with the **InputObject** parameter.
```yaml Type: System.Management.Automation.PSObject[]