Updates from: 04/06/2021 03:15:32
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Core Get Command (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Core/Get-Command.md
external help file: System.Management.Automation.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Core Previously updated : 06/09/2017 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Command --- # Get-Command
-## SYNOPSIS
+## Synopsis
Gets all commands.
-## SYNTAX
+## Syntax
### CmdletSet (Default)
Get-Command [[-Name] <String[]>] [-Module <String[]>] [-FullyQualifiedModule <Mo
[-All] [-ListImported] [-ParameterName <String[]>] [-ParameterType <PSTypeName[]>] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Command` cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. `Get-Command` gets the commands from
information from help topics.
Starting in Windows PowerShell 5.0, results of the `Get-Command` cmdlet display a **Version** column by default. A new **Version** property has been added to the **CommandInfo** class.
-## EXAMPLES
+## Examples
### Example 1: Get cmdlets, functions, and aliases
preference variable. For more information, see [about_Preference_Variables](../M
### Example 6: Get the syntax of a cmdlet
-This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the `Get-ChildItem`
-cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive that the
-Certificate Provider adds to the session.
+This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the
+`Get-ChildItem` cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive
+that the Certificate Provider adds to the session.
```powershell
-Get-Command Get-Childitem -Args Cert: -Syntax
+Get-Command -Name Get-Childitem -Args Cert: -Syntax
``` When you compare the syntax displayed in the output with the syntax that is displayed when you omit
that the Certificate provider adds to the `Get-ChildItem` cmdlet when it is used
function Get-DynamicParameters { param ($Cmdlet, $PSDrive)
- (Get-Command $Cmdlet -ArgumentList $PSDrive).ParameterSets | ForEach-Object {$_.Parameters} | Where-Object { $_.IsDynamic } | Select-Object -Property Name -Unique
+ (Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets |
+ ForEach-Object {$_.Parameters} |
+ Where-Object { $_.IsDynamic } |
+ Select-Object -Property Name -Unique
} Get-DynamicParameters -Cmdlet Get-ChildItem -PSDrive Cert: ```
value from those that take an **AuthenticationLevel** parameter, even when they
This example shows how to use the `Get-Command` cmdlet with an alias. ```powershell
-Get-Command dir
+Get-Command -Name dir
``` ```Output
view shows the alias and the full command name.
### Example 11: Get all instances of the Notepad command
-This example uses the **All** parameter of the `Get-Command` cmdlet to show all instances of the "Notepad" command on the local computer.
+This example uses the **All** parameter of the `Get-Command` cmdlet to show all instances of the
+`Notepad` command on the local computer.
```powershell Get-Command Notepad -All | Format-Table CommandType, Name, Definition
The command uses the **ModuleName** property of all commands.
Microsoft.PowerShell.Utility ```
-This command format works on commands in PowerShell modules, even if they are not imported into the session.
+This command format works on commands in PowerShell modules, even if they are not imported into the
+session.
### Example 13: Get cmdlets and functions that have an output type
This command format works on commands in PowerShell modules, even if they are no
Get-Command -Type Cmdlet | Where-Object OutputType | Format-List -Property Name, OutputType ```
-This command gets the cmdlets and functions that have an output type and the type of objects that they return.
+This command gets the cmdlets and functions that have an output type and the type of objects that
+they return.
-The first part of the command gets all cmdlets.
-A pipeline operator (|) sends the cmdlets to the `Where-Object` cmdlet, which selects only the ones in which the **OutputType** property is populated.
-Another pipeline operator sends the selected cmdlet objects to the `Format-List` cmdlet, which displays the name and output type of each cmdlet in a list.
+The first part of the command gets all cmdlets. A pipeline operator (`|`) sends the cmdlets to the
+`Where-Object` cmdlet, which selects only the ones in which the **OutputType** property is
+populated. Another pipeline operator sends the selected cmdlet objects to the `Format-List` cmdlet,
+which displays the name and output type of each cmdlet in a list.
-The **OutputType** property of a **CommandInfo** object has a non-null value only when the cmdlet code defines the **OutputType** attribute for the cmdlet.
+The **OutputType** property of a **CommandInfo** object has a non-null value only when the cmdlet
+code defines the **OutputType** attribute for the cmdlet.
### Example 14: Get cmdlets that take a specific object type as input
to find the cmdlets that accept the type of objects that any command returns.
The command uses the **PSTypeNames** intrinsic property of all objects, which gets the types that describe the object. To get the **PSTypeNames** property of a net adapter, and not the **PSTypeNames** property of a collection of net adapters, the command uses array notation to get the
-first net adapter that the cmdlet returns.
-To get the **PSTypeNames** property of a net adapter, and not the **PSTypeNames** property of a collection of net adapters, the command uses array notation to get the first net adapter that the cmdlet returns.
+first net adapter that the cmdlet returns. To get the **PSTypeNames** property of a net adapter, and
+not the **PSTypeNames** property of a collection of net adapters, the command uses array notation to
+get the first net adapter that the cmdlet returns.
-## PARAMETERS
+## Parameters
### -All
aliases.
The acceptable values for this parameter are: -- Alias. Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).-- All. Gets all command types. This parameter value is the equivalent of `Get-Command *`.-- Application. Gets non-PowerShell files in paths listed in the **Path** environment
- variable ($env:path), including .txt, .exe, and .dll files. For more information about the
- **Path** environment variable, see about_Environment_Variables.
-- Cmdlet. Gets all cmdlets.-- ExternalScript. Gets all .ps1 files in the paths listed in the **Path** environment variable
- ($env:path).
-- Filter and Function. Gets all PowerShell advanced and simple functions and filters.-- Script. Gets all script blocks. To get PowerShell scripts (.ps1 files), use the ExternalScript
+- `Alias`: Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).
+- `All`: Gets all command types. This parameter value is the equivalent of `Get-Command *`.
+- `Application`: Gets non-PowerShell files in paths listed in the **Path** environment
+ variable (`$env:path`), including .txt, .exe, and .dll files. For more information about the
+ **Path** environment variable, see [about_Environment_Variables](About/about_Environment_Variables.md).
+- `Cmdlet`: Gets all cmdlets.
+- `ExternalScript`: Gets all .ps1 files in the paths listed in the **Path** environment variable
+ (`$env:path`).
+- `Filter` and `Function`: Gets all PowerShell advanced and simple functions and filters.
+- `Script`: Gets all script blocks. To get PowerShell scripts (.ps1 files), use the `ExternalScript`
value.-- Workflow. Gets all workflows. For more information about workflows, see Introducing Windows PowerShell Workflow.
+- `Workflow`: Gets all workflows. For more information about workflows, see Introducing Windows
+ PowerShell Workflow.
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
```yaml Type: System.Management.Automation.CommandTypes
Accept wildcard characters: False
### -FullyQualifiedModule Specifies modules with names that are specified in the form of **ModuleSpecification** objects,
-described in the **Remarks** section of
-[ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
+described in the **Remarks** section of [ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
For example, the **FullyQualifiedModule** parameter accepts a module name that is specified in one of the following formats:
Accept wildcard characters: False
Indicates that this cmdlet gets only commands in the current session.
-Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands,
-including, but not limited to, the commands in the current session. In PowerShell 2.0, it
-gets only commands in the current session.
+Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands, including, but
+not limited to, the commands in the current session. In PowerShell 2.0, it gets only commands in the
+current session.
This parameter was introduced in Windows PowerShell 3.0.
Accept wildcard characters: False
### -Module
-Specifies an array of modules. This cmdlet gets the commands that came from the specified modules
-or snap-ins. Enter the names of modules or snap-ins.
+Specifies an array of modules. This cmdlet gets the commands that came from the specified modules or
+snap-ins. Enter the names of modules or snap-ins.
-This parameter takes string values, but the value of this parameter can also be a **PSModuleInfo** or **PSSnapinInfo**
-object, such as the objects that the `Get-Module`, `Get-PSSnapin`, and `Import-PSSession` cmdlets return.
+This parameter takes string values, but the value of this parameter can also be a **PSModuleInfo**
+or **PSSnapinInfo** object, such as the objects that the `Get-Module`, `Get-PSSnapin`, and
+`Import-PSSession` cmdlets return.
-You can refer to this parameter by its name, **Module**, or by its alias, **PSSnapin**.
-The parameter name that you choose has no effect on the command output.
+You can refer to this parameter by its name, **Module**, or by its alias, **PSSnapin**. The
+parameter name that you choose has no effect on the command output.
```yaml Type: System.String[]
Accept wildcard characters: False
Indicates that this cmdlet gets only the following specified data about the command: -- Aliases. Gets the standard name.
+- Aliases Gets the standard name.
- Cmdlets. Gets the syntax. - Functions and filters. Gets the function definition. - Scripts and applications or files. Gets the path and filename.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String You can pipe command names to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.CommandInfo
Represents functions and filters.
Represents workflows.
-## NOTES
+## Notes
-* When more than one command that has the same name is available to the session, `Get-Command`
+- When more than one command that has the same name is available to the session, `Get-Command`
returns the command that runs when you type the command name. To get commands that have the same name, listed in run order, use the **All** parameter. For more information, see [about_Command_Precedence](../Microsoft.PowerShell.Core/About/about_Command_Precedence.md).
-* When a module is imported automatically, the effect is the same as using the `Import-Module`
+- When a module is imported automatically, the effect is the same as using the `Import-Module`
cmdlet. The module can add commands, types and formatting files, and run scripts in the session. To enable, disable, and configuration automatic importing of modules, use the `$PSModuleAutoLoadingPreference` preference variable. For more information, see [about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md).
-## RELATED LINKS
+## Related Links
[Export-PSSession](../Microsoft.PowerShell.Utility/Export-PSSession.md)
Microsoft.PowerShell.Utility Get Member (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Get-Member.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 05/06/2020 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/get-member?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Member --- # Get-Member
-## SYNOPSIS
+## Synopsis
Gets the properties and methods of objects.
-## SYNTAX
+## Syntax
``` Get-Member [-InputObject <PSObject>] [[-Name] <String[]>] [-MemberType <PSMemberTypes>] [-View <PSMemberViewTypes>] [-Static] [-Force] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Member` cmdlet gets the members, the properties and methods, of objects.
information about static members, the members of the class, not of the instance,
parameter. To get only certain types of members, such as **NoteProperties**, use the **MemberType** parameter.
-## EXAMPLES
+## Examples
### Example 1: Get the members of process objects
LastWriteTimeUtc
Attributes ```
-## PARAMETERS
+## Parameters
### -Force Adds the intrinsic members and the compiler-generated **get_** and **set_** methods to the display. The following list describes the properties that are added when you use the **Force** parameter: -- **PSBase**: The original properties of the .NET object without extension or adaptation. These are
+- `PSBase`: The original properties of the .NET object without extension or adaptation. These are
the properties defined for the object class.-- **PSAdapted**. The properties and methods defined in the PowerShell extended type system.-- **PSExtended**. The properties and methods that were added in the `Types.ps1xml` files or by using
+- `PSAdapted`: The properties and methods defined in the PowerShell extended type system.
+- `PSExtended`: The properties and methods that were added in the `Types.ps1xml` files or by using
the `Add-Member` cmdlet.-- **PSObject**. The adapter that converts the base object to a PowerShell **PSObject** object.-- **PSTypeNames**. A list of object types that describe the object, in order of specificity. When
+- `PSObject`: The adapter that converts the base object to a PowerShell **PSObject** object.
+- `PSTypeNames`: A list of object types that describe the object, in order of specificity. When
formatting the object, PowerShell searches for the types in the `Format.ps1xml` files in the PowerShell installation directory (`$PSHOME`). It uses the formatting definition for the first type that it finds.
Accept wildcard characters: False
### -MemberType
-Specifies the member type that this cmdlet gets. The default is **All**.
+Specifies the member type that this cmdlet gets. The default is `All`.
The acceptable values for this parameter are: -- AliasProperty-- CodeProperty-- Property-- NoteProperty-- ScriptProperty-- Properties-- PropertySet-- Method-- CodeMethod-- ScriptMethod-- Methods-- ParameterizedProperty-- MemberSet-- Event-- Dynamic-- All
+- `AliasProperty`
+- `CodeProperty`
+- `Property`
+- `NoteProperty`
+- `ScriptProperty`
+- `Properties`
+- `PropertySet`
+- `Method`
+- `CodeMethod`
+- `ScriptMethod`
+- `Methods`
+- `ParameterizedProperty`
+- `MemberSet`
+- `Event`
+- `Dynamic`
+- `All`
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **MemberType** parameter as
+an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
For information about these values, see [PSMemberTypes Enumeration](/dotnet/api/system.management.automation.psmembertypes). Not all objects have every type of member. If you specify a member type that the object does not
-have, PowerShell returns a null value.
-
-To get related types of members, such as all extended members, use the **View** parameter. If you
-use the **MemberType** parameter with the **Static** or **View** parameters, `Get-Member` gets the
-members that belong to both sets.
+have, PowerShell returns a null value. To get related types of members, such as all extended
+members, use the **View** parameter. If you use the **MemberType** parameter with the **Static** or
+**View** parameters, `Get-Member` gets the members that belong to both sets.
```yaml Type: System.Management.Automation.PSMemberTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Management.Automation.PSObject You can pipe any object to `Get-Member`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.MemberDefinition `Get-Member` returns an object for each property or method that its gets.
-## NOTES
+## Notes
You can get information about a collection object either by using the **InputObject** parameter or by piping the object, preceded by a comma, to `Get-Member`.
return information about the `[System.RuntimeType]` type. However, when you use
parameter, `Get-Member` returns the static members of the specific type represented by the `System.RuntimeType` instance.
-## RELATED LINKS
+## Related Links
[Add-Member](Add-Member.md)
Microsoft.PowerShell.Utility Import Pssession (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Import-PSSession.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 06/09/2017 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/import-pssession?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Import-PSSession --- # Import-PSSession
-## SYNOPSIS
+## Synopsis
Imports commands from another session into the current session.
-## SYNTAX
+## Syntax
``` Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <String[]>] [-AllowClobber]
Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <Stri
[-Certificate <X509Certificate2>] [-Session] <PSSession> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Import-PSSession` cmdlet imports commands , such as cmdlets, functions, and aliases, from a PSSession on a local or remote computer into the current session. You can import any command that
Beginning in Windows PowerShell 3.0, you can use the `Import-Module` cmdlet to i
remote session into the current session. This feature uses implicit remoting. It is equivalent to using `Import-PSSession` to import selected modules from a remote session into the current session.
-## EXAMPLES
+## Examples
### Example 1: Import all commands from a PSSession ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S
``` This command imports all commands from a PSSession on the Server01 computer into the current
formatting data required for the imported commands.
### Example 2: Import commands that end with a specific string ```
-PS C:\> $S = New-PSSession https://ps.testlabs.com/powershell
-PS C:\> Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
-PS C:\> New-Test -Name Test1
-PS C:\> Get-Test test1 | Run-Test
+$S = New-PSSession https://ps.testlabs.com/powershell
+Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
+New-Test -Name Test1
+Get-Test test1 | Run-Test
``` These commands import the commands with names that end in "-test" from a PSSession into the local
need to use the `Invoke-Command` cmdlet to run an imported command.
### Example 3: Import cmdlets from a PSSession ```
-PS C:\> $S1 = New-PSSession -ComputerName s1
-PS C:\> $S2 = New-PSSession -ComputerName s2
-PS C:\> Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
-PS C:\> Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
-PS C:\> New-Test Test1 | Set-Test -RunType Full
+$S1 = New-PSSession -ComputerName s1
+$S2 = New-PSSession -ComputerName s2
+Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
+Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
+New-Test Test1 | Set-Test -RunType Full
``` This example shows that you can use imported cmdlets just as you would use local cmdlets.
cmdlet to another without error.
### Example 4: Run an imported command as a background job ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
-PS C:\> $batch = New-Test -Name Batch -AsJob
-PS C:\> Receive-Job $batch
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
+$batch = New-Test -Name Batch -AsJob
+Receive-Job $batch
``` This example shows how to run an imported command as a background job.
variable.
### Example 5: Import cmdlets and functions from a Windows PowerShell module ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Invoke-Command -Session $S {Import-Module TestManagement}
-PS C:\> Import-PSSession -Session $S -Module TestManagement
+$S = New-PSSession -ComputerName Server01
+Invoke-Command -Session $S {Import-Module TestManagement}
+Import-PSSession -Session $S -Module TestManagement
``` This example shows how to import the cmdlets and functions from a Windows PowerShell module on a
which returns the module name.
The `Get-Command` command is the equivalent of `Get-Command $M.Name`".
-## PARAMETERS
+## Parameters
### -AllowClobber
Accept wildcard characters: False
Specifies the type of command objects. The default value is Cmdlet. Use **CommandType** or its alias, **Type**. The acceptable values for this parameter are: -- Alias. The Windows PowerShell aliases in the remote session.-- All. The cmdlets and functions in the remote session.-- Application. All the files other than Windows-PowerShell files in the paths that are listed in the
- Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
+- `Alias`: The Windows PowerShell aliases in the remote session.
+- `All`: The cmdlets and functions in the remote session.
+- `Application`: All the files other than Windows-PowerShell files in the paths that are listed in
+ the Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
files.-- Cmdlet. The cmdlets in the remote session. "Cmdlet" is the default.-- ExternalScript. The .ps1 files in the paths listed in the Path environment variable (`$env:path`)
- in the remote session.
-- Filter and Function. The Windows PowerShell functions in the remote session.-- Script. The script blocks in the remote session.
+- `Cmdlet`: The cmdlets in the remote session. "Cmdlet" is the default.
+- `ExternalScript`: The .ps1 files in the paths listed in the Path environment variable
+ (`$env:path`) in the remote session.
+- `Filter` and `Function`: The Windows PowerShell functions in the remote session.
+- `Script`: The script blocks in the remote session.
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
```yaml Type: System.Management.Automation.CommandTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### None You cannot pipe objects to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.PSModuleInfo
You cannot pipe objects to this cmdlet.
However, the imported module is temporary and exists only in the current session. To create a permanent module on disk, use the `Export-PSSession` cmdlet.
-## NOTES
+## Notes
- `Import-PSSession` relies on the PowerShell remoting infrastructure. To use this cmdlet, the computer must be configured for WS-Management remoting. For more information, see
permanent module on disk, use the `Export-PSSession` cmdlet.
include the prefix that you assign by using the **Prefix** parameter. To get help for an imported command in Windows PowerShell 2.0, use the original (non-prefixed) command name.
-## RELATED LINKS
+## Related Links
[Export-PSSession](Export-PSSession.md)
Microsoft.PowerShell.Utility Invoke Webrequest (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 01/26/2021 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-WebRequest --- # Invoke-WebRequest
-## SYNOPSIS
+## Synopsis
Gets content from a web page on the Internet.
-## SYNTAX
+## Syntax
``` Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSession>] [-SessionVariable <String>]
Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSessio
[-TransferEncoding <String>] [-InFile <String>] [-OutFile <String>] [-PassThru] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-WebRequest` cmdlet sends HTTP, HTTPS, FTP, and FILE requests to a web page or web service. It parses the response and returns collections of forms, links, images, and other significant HTML elements.
It parses the response and returns collections of forms, links, images, and othe
This cmdlet was introduced in Windows PowerShell 3.0. > [!NOTE]
-> By default,
-> script code in the web page may be run when the page is being parsed to populate the `ParsedHtml` property.
-> Use the `-UseBasicParsing` switch to suppress this.
+> By default, script code in the web page may be run when the page is being parsed to populate the
+> `ParsedHtml` property. Use the `-UseBasicParsing` switch to suppress this.
-## EXAMPLES
+## Examples
### Example 1: Send a web request
$StatusCode
The terminating error is caught by the `catch` block, which retrieves the **StatusCode** from the **Exception** object.
-## PARAMETERS
+## Parameters
### -Body
Accept wildcard characters: False
Specifies the method used for the web request. The acceptable values for this parameter are: -- Default-- Delete-- Get-- Head-- Merge-- Options-- Patch-- Post-- Put-- Trace
+- `Default`
+- `Delete`
+- `Get`
+- `Head`
+- `Merge`
+- `Options`
+- `Patch`
+- `Post`
+- `Put`
+- `Trace`
```yaml Type: Microsoft.PowerShell.Commands.WebRequestMethod
Accept wildcard characters: False
Specifies a value for the transfer-encoding HTTP response header. The acceptable values for this parameter are: -- Chunked-- Compress-- Deflate-- GZip-- Identity
+- `Chunked`
+- `Compress`
+- `Deflate`
+- `GZip`
+- `Identity`
```yaml Type: System.String
Accept wildcard characters: False
### -UseDefaultCredentials
-Indicates that the cmdet uses the credentials of the current user to send the web request.
+Indicates that the cmdlet uses the credentials of the current user to send the web request.
```yaml Type: System.Management.Automation.SwitchParameter
This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVar
`-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Object You can pipe the body of a web request to `Invoke-WebRequest`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.HtmlWebResponseObject
-## NOTES
+## Notes
-## RELATED LINKS
+## Related Links
[Invoke-RestMethod](Invoke-RestMethod.md)
Microsoft.PowerShell.Core Get Command (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Core/Get-Command.md
external help file: System.Management.Automation.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Core Previously updated : 12/14/2018 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Command --- # Get-Command
-## SYNOPSIS
+## Synopsis
Gets all commands.
-## SYNTAX
+## Syntax
### CmdletSet (Default)
Get-Command [[-Name] <String[]>] [-Module <String[]>]
[-UseAbbreviationExpansion] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Command` cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. `Get-Command` gets the commands from
information from help topics.
Starting in Windows PowerShell 5.0, results of the `Get-Command` cmdlet display a **Version** column by default. A new **Version** property has been added to the **CommandInfo** class.
-## EXAMPLES
+## Examples
### Example 1: Get cmdlets, functions, and aliases
preference variable. For more information, see [about_Preference_Variables](../M
### Example 6: Get the syntax of a cmdlet
-This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the `Get-ChildItem`
-cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive that the
-Certificate Provider adds to the session.
+This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the
+`Get-ChildItem` cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive
+that the Certificate Provider adds to the session.
```powershell
-Get-Command Get-Childitem -Args Cert: -Syntax
+Get-Command -Name Get-Childitem -Args Cert: -Syntax
``` When you compare the syntax displayed in the output with the syntax that is displayed when you omit
that the Certificate provider adds to the `Get-ChildItem` cmdlet when it is used
function Get-DynamicParameters { param ($Cmdlet, $PSDrive)
- (Get-Command $Cmdlet -ArgumentList $PSDrive).ParameterSets | ForEach-Object {$_.Parameters} | Where-Object { $_.IsDynamic } | Select-Object -Property Name -Unique
+ (Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets |
+ ForEach-Object {$_.Parameters} |
+ Where-Object { $_.IsDynamic } |
+ Select-Object -Property Name -Unique
} Get-DynamicParameters -Cmdlet Get-ChildItem -PSDrive Cert: ```
value from those that take an **AuthenticationLevel** parameter, even when they
This example shows how to use the `Get-Command` cmdlet with an alias. ```powershell
-Get-Command dir
+Get-Command -Name dir
``` ```Output
view shows the alias and the full command name.
### Example 11: Get all instances of the Notepad command
-This example uses the **All** parameter of the `Get-Command` cmdlet to show all instances of the "Notepad" command on the local computer.
+This example uses the **All** parameter of the `Get-Command` cmdlet to show all instances of the
+`Notepad` command on the local computer.
```powershell Get-Command Notepad -All | Format-Table CommandType, Name, Definition
The command uses the **ModuleName** property of all commands.
Microsoft.PowerShell.Utility ```
-This command format works on commands in PowerShell modules, even if they are not imported into the session.
+This command format works on commands in PowerShell modules, even if they are not imported into the
+session.
### Example 13: Get cmdlets and functions that have an output type
This command format works on commands in PowerShell modules, even if they are no
Get-Command -Type Cmdlet | Where-Object OutputType | Format-List -Property Name, OutputType ```
-This command gets the cmdlets and functions that have an output type and the type of objects that they return.
+This command gets the cmdlets and functions that have an output type and the type of objects that
+they return.
-The first part of the command gets all cmdlets.
-A pipeline operator (|) sends the cmdlets to the `Where-Object` cmdlet, which selects only the ones in which the **OutputType** property is populated.
-Another pipeline operator sends the selected cmdlet objects to the `Format-List` cmdlet, which displays the name and output type of each cmdlet in a list.
+The first part of the command gets all cmdlets. A pipeline operator (`|`) sends the cmdlets to the
+`Where-Object` cmdlet, which selects only the ones in which the **OutputType** property is
+populated. Another pipeline operator sends the selected cmdlet objects to the `Format-List` cmdlet,
+which displays the name and output type of each cmdlet in a list.
-The **OutputType** property of a **CommandInfo** object has a non-null value only when the cmdlet code defines the **OutputType** attribute for the cmdlet.
+The **OutputType** property of a **CommandInfo** object has a non-null value only when the cmdlet
+code defines the **OutputType** attribute for the cmdlet.
### Example 14: Get cmdlets that take a specific object type as input
Application getconf 0.0.0.0 /u
Application command 0.0.0.0 /usr/bin/command ```
-## PARAMETERS
+## Parameters
### -All
aliases.
The acceptable values for this parameter are: -- Alias. Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).-- All. Gets all command types. This parameter value is the equivalent of `Get-Command *`.-- Application. Gets non-PowerShell files in paths listed in the **Path** environment
- variable ($env:path), including .txt, .exe, and .dll files. For more information about the
- **Path** environment variable, see about_Environment_Variables.
-- Cmdlet. Gets all cmdlets.-- ExternalScript. Gets all .ps1 files in the paths listed in the **Path** environment variable
- ($env:path).
-- Filter and Function. Gets all PowerShell advanced and simple functions and filters.-- Script. Gets all script blocks. To get PowerShell scripts (.ps1 files), use the ExternalScript
+- `Alias`: Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).
+- `All`: Gets all command types. This parameter value is the equivalent of `Get-Command *`.
+- `Application`: Gets non-PowerShell files in paths listed in the **Path** environment
+ variable (`$env:path`), including .txt, .exe, and .dll files. For more information about the
+ **Path** environment variable, see [about_Environment_Variables](About/about_Environment_Variables.md).
+- `Cmdlet`: Gets all cmdlets.
+- `ExternalScript`: Gets all .ps1 files in the paths listed in the **Path** environment variable
+ (`$env:path`).
+- `Filter` and `Function`: Gets all PowerShell advanced and simple functions and filters.
+- `Script`: Gets all script blocks. To get PowerShell scripts (.ps1 files), use the `ExternalScript`
value.
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
+ ```yaml Type: System.Management.Automation.CommandTypes Parameter Sets: AllCommandSet
Accept wildcard characters: False
### -FullyQualifiedModule Specifies modules with names that are specified in the form of **ModuleSpecification** objects,
-described in the **Remarks** section of
-[ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
+described in the **Remarks** section of [ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
For example, the **FullyQualifiedModule** parameter accepts a module name that is specified in one of the following formats:
Accept wildcard characters: False
Indicates that this cmdlet gets only commands in the current session.
-Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands,
-including, but not limited to, the commands in the current session. In PowerShell 2.0, it
-gets only commands in the current session.
+Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands, including, but
+not limited to, the commands in the current session. In PowerShell 2.0, it gets only commands in the
+current session.
This parameter was introduced in Windows PowerShell 3.0.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String You can pipe command names to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.CommandInfo
Represents cmdlets.
Represents functions and filters.
-## NOTES
+## Notes
-* When more than one command that has the same name is available to the session, `Get-Command`
+- When more than one command that has the same name is available to the session, `Get-Command`
returns the command that runs when you type the command name. To get commands that have the same name, listed in run order, use the **All** parameter. For more information, see [about_Command_Precedence](../Microsoft.PowerShell.Core/About/about_Command_Precedence.md).
-* When a module is imported automatically, the effect is the same as using the `Import-Module`
+- When a module is imported automatically, the effect is the same as using the `Import-Module`
cmdlet. The module can add commands, types and formatting files, and run scripts in the session. To enable, disable, and configuration automatic importing of modules, use the `$PSModuleAutoLoadingPreference` preference variable. For more information, see [about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md).
-## RELATED LINKS
+## Related Links
[Export-PSSession](../Microsoft.PowerShell.Utility/Export-PSSession.md)
Microsoft.PowerShell.Utility Get Member (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Get-Member.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 05/06/2020 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/get-member?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Member --- # Get-Member
-## SYNOPSIS
+## Synopsis
Gets the properties and methods of objects.
-## SYNTAX
+## Syntax
``` Get-Member [-InputObject <PSObject>] [[-Name] <String[]>] [-MemberType <PSMemberTypes>] [-View <PSMemberViewTypes>] [-Static] [-Force] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Member` cmdlet gets the members, the properties and methods, of objects.
information about static members, the members of the class, not of the instance,
parameter. To get only certain types of members, such as **NoteProperties**, use the **MemberType** parameter.
-## EXAMPLES
+## Examples
### Example 1: Get the members of process objects
LastWriteTimeUtc
Attributes ```
-## PARAMETERS
+## Parameters
### -Force Adds the intrinsic members and the compiler-generated **get_** and **set_** methods to the display. The following list describes the properties that are added when you use the **Force** parameter: -- **PSBase**: The original properties of the .NET object without extension or adaptation. These are
+- `PSBase`: The original properties of the .NET object without extension or adaptation. These are
the properties defined for the object class.-- **PSAdapted**. The properties and methods defined in the PowerShell extended type system.-- **PSExtended**. The properties and methods that were added in the `Types.ps1xml` files or by using
+- `PSAdapted`: The properties and methods defined in the PowerShell extended type system.
+- `PSExtended`: The properties and methods that were added in the `Types.ps1xml` files or by using
the `Add-Member` cmdlet.-- **PSObject**. The adapter that converts the base object to a PowerShell **PSObject** object.-- **PSTypeNames**. A list of object types that describe the object, in order of specificity. When
+- `PSObject`: The adapter that converts the base object to a PowerShell **PSObject** object.
+- `PSTypeNames`: A list of object types that describe the object, in order of specificity. When
formatting the object, PowerShell searches for the types in the `Format.ps1xml` files in the PowerShell installation directory (`$PSHOME`). It uses the formatting definition for the first type that it finds.
Accept wildcard characters: False
### -MemberType
-Specifies the member type that this cmdlet gets. The default is **All**.
+Specifies the member type that this cmdlet gets. The default is `All`.
The acceptable values for this parameter are: -- AliasProperty-- CodeProperty-- Property-- NoteProperty-- ScriptProperty-- Properties-- PropertySet-- Method-- CodeMethod-- ScriptMethod-- Methods-- ParameterizedProperty-- MemberSet-- Event-- Dynamic-- All
+- `AliasProperty`
+- `CodeProperty`
+- `Property`
+- `NoteProperty`
+- `ScriptProperty`
+- `Properties`
+- `PropertySet`
+- `Method`
+- `CodeMethod`
+- `ScriptMethod`
+- `Methods`
+- `ParameterizedProperty`
+- `MemberSet`
+- `Event`
+- `Dynamic`
+- `All`
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **MemberType** parameter as
+an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
For information about these values, see [PSMemberTypes Enumeration](/dotnet/api/system.management.automation.psmembertypes). Not all objects have every type of member. If you specify a member type that the object does not
-have, PowerShell returns a null value.
-
-To get related types of members, such as all extended members, use the **View** parameter. If you
-use the **MemberType** parameter with the **Static** or **View** parameters, `Get-Member` gets the
-members that belong to both sets.
+have, PowerShell returns a null value. To get related types of members, such as all extended
+members, use the **View** parameter. If you use the **MemberType** parameter with the **Static** or
+**View** parameters, `Get-Member` gets the members that belong to both sets.
```yaml Type: System.Management.Automation.PSMemberTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Management.Automation.PSObject You can pipe any object to `Get-Member`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.MemberDefinition `Get-Member` returns an object for each property or method that its gets.
-## NOTES
+## Notes
You can get information about a collection object either by using the **InputObject** parameter or by piping the object, preceded by a comma, to `Get-Member`.
return information about the `[System.RuntimeType]` type. However, when you use
parameter, `Get-Member` returns the static members of the specific type represented by the `System.RuntimeType` instance.
-## RELATED LINKS
+## Related Links
[Add-Member](Add-Member.md)
Microsoft.PowerShell.Utility Import Pssession (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Import-PSSession.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 06/09/2017 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/import-pssession?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Import-PSSession --- # Import-PSSession
-## SYNOPSIS
+## Synopsis
Imports commands from another session into the current session.
-## SYNTAX
+## Syntax
``` Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <String[]>] [-AllowClobber]
Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <Stri
[-Certificate <X509Certificate2>] [-Session] <PSSession> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Import-PSSession` cmdlet imports commands , such as cmdlets, functions, and aliases, from a PSSession on a local or remote computer into the current session. You can import any command that
Beginning in Windows PowerShell 3.0, you can use the `Import-Module` cmdlet to i
remote session into the current session. This feature uses implicit remoting. It is equivalent to using `Import-PSSession` to import selected modules from a remote session into the current session.
-## EXAMPLES
+## Examples
### Example 1: Import all commands from a PSSession ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S
``` This command imports all commands from a PSSession on the Server01 computer into the current
formatting data required for the imported commands.
### Example 2: Import commands that end with a specific string ```
-PS C:\> $S = New-PSSession https://ps.testlabs.com/powershell
-PS C:\> Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
-PS C:\> New-Test -Name Test1
-PS C:\> Get-Test test1 | Run-Test
+$S = New-PSSession https://ps.testlabs.com/powershell
+Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
+New-Test -Name Test1
+Get-Test test1 | Run-Test
``` These commands import the commands with names that end in "-test" from a PSSession into the local
need to use the `Invoke-Command` cmdlet to run an imported command.
### Example 3: Import cmdlets from a PSSession ```
-PS C:\> $S1 = New-PSSession -ComputerName s1
-PS C:\> $S2 = New-PSSession -ComputerName s2
-PS C:\> Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
-PS C:\> Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
-PS C:\> New-Test Test1 | Set-Test -RunType Full
+$S1 = New-PSSession -ComputerName s1
+$S2 = New-PSSession -ComputerName s2
+Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
+Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
+New-Test Test1 | Set-Test -RunType Full
``` This example shows that you can use imported cmdlets just as you would use local cmdlets.
cmdlet to another without error.
### Example 4: Run an imported command as a background job ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
-PS C:\> $batch = New-Test -Name Batch -AsJob
-PS C:\> Receive-Job $batch
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
+$batch = New-Test -Name Batch -AsJob
+Receive-Job $batch
``` This example shows how to run an imported command as a background job.
variable.
### Example 5: Import cmdlets and functions from a Windows PowerShell module ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Invoke-Command -Session $S {Import-Module TestManagement}
-PS C:\> Import-PSSession -Session $S -Module TestManagement
+$S = New-PSSession -ComputerName Server01
+Invoke-Command -Session $S {Import-Module TestManagement}
+Import-PSSession -Session $S -Module TestManagement
``` This example shows how to import the cmdlets and functions from a Windows PowerShell module on a
which returns the module name.
The `Get-Command` command is the equivalent of `Get-Command $M.Name`".
-## PARAMETERS
+## Parameters
### -AllowClobber
Accept wildcard characters: False
Specifies the type of command objects. The default value is Cmdlet. Use **CommandType** or its alias, **Type**. The acceptable values for this parameter are: -- Alias. The Windows PowerShell aliases in the remote session.-- All. The cmdlets and functions in the remote session.-- Application. All the files other than Windows-PowerShell files in the paths that are listed in the
- Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
+- `Alias`: The Windows PowerShell aliases in the remote session.
+- `All`: The cmdlets and functions in the remote session.
+- `Application`: All the files other than Windows-PowerShell files in the paths that are listed in
+ the Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
files.-- Cmdlet. The cmdlets in the remote session. "Cmdlet" is the default.-- ExternalScript. The .ps1 files in the paths listed in the Path environment variable (`$env:path`)
- in the remote session.
-- Filter and Function. The Windows PowerShell functions in the remote session.-- Script. The script blocks in the remote session.
+- `Cmdlet`: The cmdlets in the remote session. "Cmdlet" is the default.
+- `ExternalScript`: The .ps1 files in the paths listed in the Path environment variable
+ (`$env:path`) in the remote session.
+- `Filter` and `Function`: The Windows PowerShell functions in the remote session.
+- `Script`: The script blocks in the remote session.
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
```yaml Type: System.Management.Automation.CommandTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### None You cannot pipe objects to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.PSModuleInfo
You cannot pipe objects to this cmdlet.
However, the imported module is temporary and exists only in the current session. To create a permanent module on disk, use the `Export-PSSession` cmdlet.
-## NOTES
+## Notes
- `Import-PSSession` relies on the PowerShell remoting infrastructure. To use this cmdlet, the computer must be configured for WS-Management remoting. For more information, see
permanent module on disk, use the `Export-PSSession` cmdlet.
include the prefix that you assign by using the **Prefix** parameter. To get help for an imported command in Windows PowerShell 2.0, use the original (non-prefixed) command name.
-## RELATED LINKS
+## Related Links
[Export-PSSession](Export-PSSession.md)
Microsoft.PowerShell.Utility Invoke Webrequest (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 01/26/2021 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-WebRequest
Title: Invoke-WebRequest
# Invoke-WebRequest
-## SYNOPSIS
+## Synopsis
Gets content from a web page on the internet.
-## SYNTAX
+## Syntax
### StandardMethod (Default)
Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSessio
[-PreserveAuthorizationOnRedirect] [-SkipHeaderValidation] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-WebRequest` cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements.
This cmdlet was introduced in PowerShell 3.0.
Beginning in PowerShell 7.0, `Invoke-WebRequest` supports proxy configuration defined by environment variables. See the [Notes](#notes) section of this article.
-## EXAMPLES
+## Examples
### Example 1: Send a web request
$StatusCode
The terminating error is caught by the `catch` block, which retrieves the **StatusCode** from the **Exception** object.
-## PARAMETERS
+## Parameters
### -AllowUnencryptedAuthentication
Specifies the explicit authentication type to use for the request. The default i
Available Authentication Options: -- **None**: This is the default option when **Authentication** isn't supplied; no explicit
+- `None`: This is the default option when **Authentication** isn't supplied; no explicit
authentication is used.-- **Basic**: Requires **Credential**. The credentials are sent in an RFC 7617 Basic Authentication
+- `Basic`: Requires **Credential**. The credentials are sent in an RFC 7617 Basic Authentication
header in the format of `base64(user:password)`.-- **Bearer**: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
+- `Bearer`: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
token. This is an alias for **OAuth**-- **OAuth**: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
+- `OAuth`: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
token. This is an alias for **Bearer** Supplying **Authentication** overrides any `Authorization` headers supplied to **Headers** or
Accept wildcard characters: False
Specifies the method used for the web request. The acceptable values for this parameter are: -- Default-- Delete-- Get-- Head-- Merge-- Options-- Patch-- Post-- Put-- Trace
+- `Default`
+- `Delete`
+- `Get`
+- `Head`
+- `Merge`
+- `Options`
+- `Patch`
+- `Post`
+- `Put`
+- `Trace`
The **CustomMethod** parameter can be used for Request Methods not listed above.
Sets the SSL/TLS protocols that are permissible for the web request. By default
protocols supported by the system are allowed. **SslProtocol** allows for limiting to specific protocols for compliance purposes.
-**SslProtocol** uses the **WebSslProtocol** Flag Enum. It is possible to supply more than one
-protocol using flag notation or combining multiple **WebSslProtocol** options with **bor**, however
-supplying multiple protocols is not supported on all platforms.
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **SslProtocol** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values. You may not be able to define multiple options on
+all platforms.
> [!NOTE] > On non-Windows platforms it may not be possible to supply `Tls` or `Tls12` as an option.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Object You can pipe the body of a web request to `Invoke-WebRequest`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.BasicHtmlWebResponseObject
-## NOTES
+## Notes
Beginning with PowerShell 6.0.0 `Invoke-WebRequest` supports basic parsing only.
The value of this property is determined by your platform:
The environment variables used for `DefaultProxy` initialization on Windows and Unix-based platforms are: -- ` HTTP_PROXY`: the hostname or IP address of the proxy server used on HTTP requests.
+- `HTTP_PROXY`: the hostname or IP address of the proxy server used on HTTP requests.
- `HTTPS_PROXY`: the hostname or IP address of the proxy server used on HTTPS requests. - `ALL_PROXY`: the hostname or IP address of the proxy server used on HTTP and HTTPS requests in case `HTTP_PROXY` or `HTTPS_PROXY` are not defined. - `NO_PROXY`: a comma-separated list of hostnames that should be excluded from proxying.
-## RELATED LINKS
+## Related Links
[Invoke-RestMethod](Invoke-RestMethod.md)
Microsoft.PowerShell.Core Get Command (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Core/Get-Command.md
external help file: System.Management.Automation.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Core Previously updated : 05/20/2020 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Command --- # Get-Command
-## SYNOPSIS
+## Synopsis
Gets all commands.
-## SYNTAX
+## Syntax
### CmdletSet (Default)
Get-Command [[-Name] <String[]>] [-Module <String[]>]
[-UseAbbreviationExpansion] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Command` cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. `Get-Command` gets the commands from
information from help topics.
Starting in Windows PowerShell 5.0, results of the `Get-Command` cmdlet display a **Version** column by default. A new **Version** property has been added to the **CommandInfo** class.
-## EXAMPLES
+## Examples
### Example 1: Get cmdlets, functions, and aliases
preference variable. For more information, see [about_Preference_Variables](../M
### Example 6: Get the syntax of a cmdlet
-This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the `Get-ChildItem`
-cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive that the
-Certificate Provider adds to the session.
+This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the
+`Get-ChildItem` cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive
+that the Certificate Provider adds to the session.
```powershell Get-Command -Name Get-Childitem -Args Cert: -Syntax
that the Certificate provider adds to the `Get-ChildItem` cmdlet when it is used
function Get-DynamicParameters { param ($Cmdlet, $PSDrive)
- (Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets | ForEach-Object {$_.Parameters} | Where-Object { $_.IsDynamic } | Select-Object -Property Name -Unique
+ (Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets |
+ ForEach-Object {$_.Parameters} |
+ Where-Object { $_.IsDynamic } |
+ Select-Object -Property Name -Unique
} Get-DynamicParameters -Cmdlet Get-ChildItem -PSDrive Cert: ```
The command uses the **ModuleName** property of all commands.
Microsoft.PowerShell.Utility ```
-This command format works on commands in PowerShell modules, even if they are not imported into the session.
+This command format works on commands in PowerShell modules, even if they are not imported into the
+session.
### Example 14: Get cmdlets and functions that have an output type
This command format works on commands in PowerShell modules, even if they are no
Get-Command -Type Cmdlet | Where-Object OutputType | Format-List -Property Name, OutputType ```
-This command gets the cmdlets and functions that have an output type and the type of objects that they return.
+This command gets the cmdlets and functions that have an output type and the type of objects that
+they return.
The first part of the command gets all cmdlets. A pipeline operator (`|`) sends the cmdlets to the `Where-Object` cmdlet, which selects only the ones in which the **OutputType** property is
Application getconf 0.0.0.0 /u
Application command 0.0.0.0 /usr/bin/command ```
-## PARAMETERS
+## Parameters
### -All
aliases.
The acceptable values for this parameter are: -- Alias. Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).-- All. Gets all command types. This parameter value is the equivalent of `Get-Command *`.-- Application. Gets non-PowerShell files in paths listed in the **Path** environment
- variable ($env:path), including .txt, .exe, and .dll files. For more information about the
- **Path** environment variable, see about_Environment_Variables.
-- Cmdlet. Gets all cmdlets.-- ExternalScript. Gets all .ps1 files in the paths listed in the **Path** environment variable
- ($env:path).
-- Filter and Function. Gets all PowerShell advanced and simple functions and filters.-- Script. Gets all script blocks. To get PowerShell scripts (.ps1 files), use the ExternalScript
+- `Alias`: Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).
+- `All`: Gets all command types. This parameter value is the equivalent of `Get-Command *`.
+- `Application`: Gets non-PowerShell files in paths listed in the **Path** environment
+ variable (`$env:path`), including .txt, .exe, and .dll files. For more information about the
+ **Path** environment variable, see [about_Environment_Variables](About/about_Environment_Variables.md).
+- `Cmdlet`: Gets all cmdlets.
+- `ExternalScript`: Gets all .ps1 files in the paths listed in the **Path** environment variable
+ (`$env:path`).
+- `Filter` and `Function`: Gets all PowerShell advanced and simple functions and filters.
+- `Script`: Gets all script blocks. To get PowerShell scripts (.ps1 files), use the `ExternalScript`
value.
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
+ ```yaml Type: System.Management.Automation.CommandTypes Parameter Sets: AllCommandSet
Accept wildcard characters: False
### -FullyQualifiedModule Specifies modules with names that are specified in the form of **ModuleSpecification** objects,
-described in the **Remarks** section of
-[ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
+described in the **Remarks** section of [ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
For example, the **FullyQualifiedModule** parameter accepts a module name that is specified in one of the following formats:
Accept wildcard characters: False
Indicates that this cmdlet gets only commands in the current session.
-Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands,
-including, but not limited to, the commands in the current session. In PowerShell 2.0, it
-gets only commands in the current session.
+Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands, including, but
+not limited to, the commands in the current session. In PowerShell 2.0, it gets only commands in the
+current session.
This parameter was introduced in Windows PowerShell 3.0.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String You can pipe command names to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.CommandInfo
Represents cmdlets.
Represents functions and filters.
-## NOTES
+## Notes
-* When more than one command that has the same name is available to the session, `Get-Command`
+- When more than one command that has the same name is available to the session, `Get-Command`
returns the command that runs when you type the command name. To get commands that have the same name, listed in run order, use the **All** parameter. For more information, see [about_Command_Precedence](../Microsoft.PowerShell.Core/About/about_Command_Precedence.md).
-* When a module is imported automatically, the effect is the same as using the `Import-Module`
+- When a module is imported automatically, the effect is the same as using the `Import-Module`
cmdlet. The module can add commands, types and formatting files, and run scripts in the session. To enable, disable, and configuration automatic importing of modules, use the `$PSModuleAutoLoadingPreference` preference variable. For more information, see [about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md).
-## RELATED LINKS
+## Related Links
[Export-PSSession](../Microsoft.PowerShell.Utility/Export-PSSession.md)
Represents functions and filters.
[Import-PSSession](../Microsoft.PowerShell.Utility/Import-PSSession.md) [about_Command_Precedence](About/about_Command_Precedence.md)-
Microsoft.PowerShell.Utility Get Member (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Get-Member.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 05/06/2020 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/get-member?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Member --- # Get-Member
-## SYNOPSIS
+## Synopsis
Gets the properties and methods of objects.
-## SYNTAX
+## Syntax
``` Get-Member [-InputObject <PSObject>] [[-Name] <String[]>] [-MemberType <PSMemberTypes>] [-View <PSMemberViewTypes>] [-Static] [-Force] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Member` cmdlet gets the members, the properties and methods, of objects.
information about static members, the members of the class, not of the instance,
parameter. To get only certain types of members, such as **NoteProperties**, use the **MemberType** parameter.
-## EXAMPLES
+## Examples
### Example 1: Get the members of process objects
LastWriteTimeUtc
Attributes ```
-## PARAMETERS
+## Parameters
### -Force Adds the intrinsic members and the compiler-generated **get_** and **set_** methods to the display. The following list describes the properties that are added when you use the **Force** parameter: -- **PSBase**: The original properties of the .NET object without extension or adaptation. These are
+- `PSBase`: The original properties of the .NET object without extension or adaptation. These are
the properties defined for the object class.-- **PSAdapted**. The properties and methods defined in the PowerShell extended type system.-- **PSExtended**. The properties and methods that were added in the `Types.ps1xml` files or by using
+- `PSAdapted`: The properties and methods defined in the PowerShell extended type system.
+- `PSExtended`: The properties and methods that were added in the `Types.ps1xml` files or by using
the `Add-Member` cmdlet.-- **PSObject**. The adapter that converts the base object to a PowerShell **PSObject** object.-- **PSTypeNames**. A list of object types that describe the object, in order of specificity. When
+- `PSObject`: The adapter that converts the base object to a PowerShell **PSObject** object.
+- `PSTypeNames`: A list of object types that describe the object, in order of specificity. When
formatting the object, PowerShell searches for the types in the `Format.ps1xml` files in the PowerShell installation directory (`$PSHOME`). It uses the formatting definition for the first type that it finds.
Accept wildcard characters: False
### -MemberType
-Specifies the member type that this cmdlet gets. The default is **All**.
+Specifies the member type that this cmdlet gets. The default is `All`.
The acceptable values for this parameter are: -- AliasProperty-- CodeProperty-- Property-- NoteProperty-- ScriptProperty-- Properties-- PropertySet-- Method-- CodeMethod-- ScriptMethod-- Methods-- ParameterizedProperty-- MemberSet-- Event-- Dynamic-- All
+- `AliasProperty`
+- `CodeProperty`
+- `Property`
+- `NoteProperty`
+- `ScriptProperty`
+- `Properties`
+- `PropertySet`
+- `Method`
+- `CodeMethod`
+- `ScriptMethod`
+- `Methods`
+- `ParameterizedProperty`
+- `MemberSet`
+- `Event`
+- `Dynamic`
+- `All`
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **MemberType** parameter as
+an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
For information about these values, see [PSMemberTypes Enumeration](/dotnet/api/system.management.automation.psmembertypes). Not all objects have every type of member. If you specify a member type that the object does not
-have, PowerShell returns a null value.
-
-To get related types of members, such as all extended members, use the **View** parameter. If you
-use the **MemberType** parameter with the **Static** or **View** parameters, `Get-Member` gets the
-members that belong to both sets.
+have, PowerShell returns a null value. To get related types of members, such as all extended
+members, use the **View** parameter. If you use the **MemberType** parameter with the **Static** or
+**View** parameters, `Get-Member` gets the members that belong to both sets.
```yaml Type: System.Management.Automation.PSMemberTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Management.Automation.PSObject You can pipe any object to `Get-Member`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.MemberDefinition `Get-Member` returns an object for each property or method that its gets.
-## NOTES
+## Notes
You can get information about a collection object either by using the **InputObject** parameter or by piping the object, preceded by a comma, to `Get-Member`.
return information about the `[System.RuntimeType]` type. However, when you use
parameter, `Get-Member` returns the static members of the specific type represented by the `System.RuntimeType` instance.
-## RELATED LINKS
+## Related Links
[Add-Member](Add-Member.md)-
Microsoft.PowerShell.Utility Import Pssession (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Import-PSSession.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
keywords: powershell,cmdlet Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 06/09/2017 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/import-pssession?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Import-PSSession --- # Import-PSSession
-## SYNOPSIS
+## Synopsis
Imports commands from another session into the current session.
-## SYNTAX
+## Syntax
``` Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <String[]>] [-AllowClobber]
Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <Stri
[-Certificate <X509Certificate2>] [-Session] <PSSession> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Import-PSSession` cmdlet imports commands , such as cmdlets, functions, and aliases, from a PSSession on a local or remote computer into the current session. You can import any command that
Beginning in Windows PowerShell 3.0, you can use the `Import-Module` cmdlet to i
remote session into the current session. This feature uses implicit remoting. It is equivalent to using `Import-PSSession` to import selected modules from a remote session into the current session.
-## EXAMPLES
+## Examples
### Example 1: Import all commands from a PSSession ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S
``` This command imports all commands from a PSSession on the Server01 computer into the current
formatting data required for the imported commands.
### Example 2: Import commands that end with a specific string ```
-PS C:\> $S = New-PSSession https://ps.testlabs.com/powershell
-PS C:\> Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
-PS C:\> New-Test -Name Test1
-PS C:\> Get-Test test1 | Run-Test
+$S = New-PSSession https://ps.testlabs.com/powershell
+Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
+New-Test -Name Test1
+Get-Test test1 | Run-Test
``` These commands import the commands with names that end in "-test" from a PSSession into the local
need to use the `Invoke-Command` cmdlet to run an imported command.
### Example 3: Import cmdlets from a PSSession ```
-PS C:\> $S1 = New-PSSession -ComputerName s1
-PS C:\> $S2 = New-PSSession -ComputerName s2
-PS C:\> Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
-PS C:\> Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
-PS C:\> New-Test Test1 | Set-Test -RunType Full
+$S1 = New-PSSession -ComputerName s1
+$S2 = New-PSSession -ComputerName s2
+Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
+Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
+New-Test Test1 | Set-Test -RunType Full
``` This example shows that you can use imported cmdlets just as you would use local cmdlets.
cmdlet to another without error.
### Example 4: Run an imported command as a background job ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
-PS C:\> $batch = New-Test -Name Batch -AsJob
-PS C:\> Receive-Job $batch
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
+$batch = New-Test -Name Batch -AsJob
+Receive-Job $batch
``` This example shows how to run an imported command as a background job.
variable.
### Example 5: Import cmdlets and functions from a Windows PowerShell module ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Invoke-Command -Session $S {Import-Module TestManagement}
-PS C:\> Import-PSSession -Session $S -Module TestManagement
+$S = New-PSSession -ComputerName Server01
+Invoke-Command -Session $S {Import-Module TestManagement}
+Import-PSSession -Session $S -Module TestManagement
``` This example shows how to import the cmdlets and functions from a Windows PowerShell module on a
which returns the module name.
The `Get-Command` command is the equivalent of `Get-Command $M.Name`".
-## PARAMETERS
+## Parameters
### -AllowClobber
Accept wildcard characters: False
Specifies the type of command objects. The default value is Cmdlet. Use **CommandType** or its alias, **Type**. The acceptable values for this parameter are: -- Alias. The Windows PowerShell aliases in the remote session.-- All. The cmdlets and functions in the remote session.-- Application. All the files other than Windows-PowerShell files in the paths that are listed in the
- Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
+- `Alias`: The Windows PowerShell aliases in the remote session.
+- `All`: The cmdlets and functions in the remote session.
+- `Application`: All the files other than Windows-PowerShell files in the paths that are listed in
+ the Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
files.-- Cmdlet. The cmdlets in the remote session. "Cmdlet" is the default.-- ExternalScript. The .ps1 files in the paths listed in the Path environment variable (`$env:path`)
- in the remote session.
-- Filter and Function. The Windows PowerShell functions in the remote session.-- Script. The script blocks in the remote session.
+- `Cmdlet`: The cmdlets in the remote session. "Cmdlet" is the default.
+- `ExternalScript`: The .ps1 files in the paths listed in the Path environment variable
+ (`$env:path`) in the remote session.
+- `Filter` and `Function`: The Windows PowerShell functions in the remote session.
+- `Script`: The script blocks in the remote session.
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
```yaml Type: System.Management.Automation.CommandTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### None You cannot pipe objects to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.PSModuleInfo
You cannot pipe objects to this cmdlet.
However, the imported module is temporary and exists only in the current session. To create a permanent module on disk, use the `Export-PSSession` cmdlet.
-## NOTES
+## Notes
- `Import-PSSession` relies on the PowerShell remoting infrastructure. To use this cmdlet, the computer must be configured for WS-Management remoting. For more information, see
permanent module on disk, use the `Export-PSSession` cmdlet.
include the prefix that you assign by using the **Prefix** parameter. To get help for an imported command in Windows PowerShell 2.0, use the original (non-prefixed) command name.
-## RELATED LINKS
+## Related Links
[Export-PSSession](Export-PSSession.md)
Microsoft.PowerShell.Utility Invoke Webrequest (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 01/26/2021 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-WebRequest
Title: Invoke-WebRequest
# Invoke-WebRequest
-## SYNOPSIS
+## Synopsis
Gets content from a web page on the internet.
-## SYNTAX
+## Syntax
### StandardMethod (Default)
Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSessio
[-PreserveAuthorizationOnRedirect] [-SkipHeaderValidation] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-WebRequest` cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements.
This cmdlet was introduced in PowerShell 3.0.
Beginning in PowerShell 7.0, `Invoke-WebRequest` supports proxy configuration defined by environment variables. See the [Notes](#notes) section of this article.
-## EXAMPLES
+## Examples
### Example 1: Send a web request
$StatusCode
The terminating error is caught by the `catch` block, which retrieves the **StatusCode** from the **Exception** object.
-## PARAMETERS
+## Parameters
### -AllowUnencryptedAuthentication
Specifies the explicit authentication type to use for the request. The default i
Available Authentication Options: -- **None**: This is the default option when **Authentication** isn't supplied; no explicit
+- `None`: This is the default option when **Authentication** isn't supplied; no explicit
authentication is used.-- **Basic**: Requires **Credential**. The credentials are sent in an RFC 7617 Basic Authentication
+- `Basic`: Requires **Credential**. The credentials are sent in an RFC 7617 Basic Authentication
header in the format of `base64(user:password)`.-- **Bearer**: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
+- `Bearer`: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
token. This is an alias for **OAuth**-- **OAuth**: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
+- `OAuth`: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
token. This is an alias for **Bearer** Supplying **Authentication** overrides any `Authorization` headers supplied to **Headers** or
Accept wildcard characters: False
Specifies the method used for the web request. The acceptable values for this parameter are: -- Default-- Delete-- Get-- Head-- Merge-- Options-- Patch-- Post-- Put-- Trace
+- `Default`
+- `Delete`
+- `Get`
+- `Head`
+- `Merge`
+- `Options`
+- `Patch`
+- `Post`
+- `Put`
+- `Trace`
The **CustomMethod** parameter can be used for Request Methods not listed above.
Sets the SSL/TLS protocols that are permissible for the web request. By default
protocols supported by the system are allowed. **SslProtocol** allows for limiting to specific protocols for compliance purposes.
-**SslProtocol** uses the **WebSslProtocol** Flag Enum. It is possible to supply more than one
-protocol using flag notation or combining multiple **WebSslProtocol** options with **bor**, however
-supplying multiple protocols is not supported on all platforms.
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **SslProtocol** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values. You may not be able to define multiple options on
+all platforms.
> [!NOTE] > On non-Windows platforms it may not be possible to supply `Tls` or `Tls12` as an option. Support
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Object You can pipe the body of a web request to `Invoke-WebRequest`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.BasicHtmlWebResponseObject
-## NOTES
+## Notes
Beginning with PowerShell 6.0.0 `Invoke-WebRequest` supports basic parsing only.
The value of this property is determined by your platform:
The environment variables used for `DefaultProxy` initialization on Windows and Unix-based platforms are: -- ` HTTP_PROXY`: the hostname or IP address of the proxy server used on HTTP requests.
+- `HTTP_PROXY`: the hostname or IP address of the proxy server used on HTTP requests.
- `HTTPS_PROXY`: the hostname or IP address of the proxy server used on HTTPS requests. - `ALL_PROXY`: the hostname or IP address of the proxy server used on HTTP and HTTPS requests in case `HTTP_PROXY` or `HTTPS_PROXY` are not defined. - `NO_PROXY`: a comma-separated list of hostnames that should be excluded from proxying.
-## RELATED LINKS
+## Related Links
[Invoke-RestMethod](Invoke-RestMethod.md)
Microsoft.PowerShell.Core Get Command (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Core/Get-Command.md
external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core Previously updated : 05/20/2020 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/get-command?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Command --- # Get-Command
-## SYNOPSIS
+## Synopsis
Gets all commands.
-## SYNTAX
+## Syntax
### CmdletSet (Default)
Get-Command [[-Name] <String[]>] [-Module <String[]>]
[-UseAbbreviationExpansion] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Command` cmdlet gets all commands that are installed on the computer, including cmdlets, aliases, functions, filters, scripts, and applications. `Get-Command` gets the commands from
information from help topics.
Starting in Windows PowerShell 5.0, results of the `Get-Command` cmdlet display a **Version** column by default. A new **Version** property has been added to the **CommandInfo** class.
-## EXAMPLES
+## Examples
### Example 1: Get cmdlets, functions, and aliases
preference variable. For more information, see [about_Preference_Variables](../M
### Example 6: Get the syntax of a cmdlet
-This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the `Get-ChildItem`
-cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive that the
-Certificate Provider adds to the session.
+This command uses the **ArgumentList** and **Syntax** parameters to get the syntax of the
+`Get-ChildItem` cmdlet when it is used in the Cert: drive. The Cert: drive is a PowerShell drive
+that the Certificate Provider adds to the session.
```powershell Get-Command -Name Get-Childitem -Args Cert: -Syntax
that the Certificate provider adds to the `Get-ChildItem` cmdlet when it is used
function Get-DynamicParameters { param ($Cmdlet, $PSDrive)
- (Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets | ForEach-Object {$_.Parameters} | Where-Object { $_.IsDynamic } | Select-Object -Property Name -Unique
+ (Get-Command -Name $Cmdlet -ArgumentList $PSDrive).ParameterSets |
+ ForEach-Object {$_.Parameters} |
+ Where-Object { $_.IsDynamic } |
+ Select-Object -Property Name -Unique
} Get-DynamicParameters -Cmdlet Get-ChildItem -PSDrive Cert: ```
value from those that take an **AuthenticationLevel** parameter, even when they
This example shows how to use the `Get-Command` cmdlet with an alias. ```powershell
-Get-Command Name dir
+Get-Command -Name dir
``` ```Output
The command uses the **ModuleName** property of all commands.
Microsoft.PowerShell.Utility ```
-This command format works on commands in PowerShell modules, even if they are not imported into the session.
+This command format works on commands in PowerShell modules, even if they are not imported into the
+session.
### Example 14: Get cmdlets and functions that have an output type
This command format works on commands in PowerShell modules, even if they are no
Get-Command -Type Cmdlet | Where-Object OutputType | Format-List -Property Name, OutputType ```
-This command gets the cmdlets and functions that have an output type and the type of objects that they return.
+This command gets the cmdlets and functions that have an output type and the type of objects that
+they return.
The first part of the command gets all cmdlets. A pipeline operator (`|`) sends the cmdlets to the `Where-Object` cmdlet, which selects only the ones in which the **OutputType** property is
Application getconf 0.0.0.0 /u
Application command 0.0.0.0 /usr/bin/command ```
-## PARAMETERS
+## Parameters
### -All
aliases.
The acceptable values for this parameter are: -- Alias. Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).-- All. Gets all command types. This parameter value is the equivalent of `Get-Command *`.-- Application. Gets non-PowerShell files in paths listed in the **Path** environment
- variable ($env:path), including .txt, .exe, and .dll files. For more information about the
- **Path** environment variable, see about_Environment_Variables.
-- Cmdlet. Gets all cmdlets.-- ExternalScript. Gets all .ps1 files in the paths listed in the **Path** environment variable
- ($env:path).
-- Filter and Function. Gets all PowerShell advanced and simple functions and filters.-- Script. Gets all script blocks. To get PowerShell scripts (.ps1 files), use the ExternalScript
+- `Alias`: Gets the aliases of all PowerShell commands. For more information, see [about_Aliases](About/about_Aliases.md).
+- `All`: Gets all command types. This parameter value is the equivalent of `Get-Command *`.
+- `Application`: Gets non-PowerShell files in paths listed in the **Path** environment
+ variable (`$env:path`), including .txt, .exe, and .dll files. For more information about the
+ **Path** environment variable, see [about_Environment_Variables](About/about_Environment_Variables.md).
+- `Cmdlet`: Gets all cmdlets.
+- `ExternalScript`: Gets all .ps1 files in the paths listed in the **Path** environment variable
+ (`$env:path`).
+- `Filter` and `Function`: Gets all PowerShell advanced and simple functions and filters.
+- `Script`: Gets all script blocks. To get PowerShell scripts (.ps1 files), use the `ExternalScript`
value.
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
+ ```yaml Type: System.Management.Automation.CommandTypes Parameter Sets: AllCommandSet
Accept wildcard characters: False
### -FullyQualifiedModule Specifies modules with names that are specified in the form of **ModuleSpecification** objects,
-described in the **Remarks** section of
-[ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
+described in the **Remarks** section of [ModuleSpecification Constructor (Hashtable)](/dotnet/api/microsoft.powershell.commands.modulespecification.-ctor?view=powershellsdk-1.1.0#Microsoft_PowerShell_Commands_ModuleSpecification__ctor_System_Collections_Hashtable_).
For example, the **FullyQualifiedModule** parameter accepts a module name that is specified in one of the following formats:
Accept wildcard characters: False
Indicates that this cmdlet gets only commands in the current session.
-Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands,
-including, but not limited to, the commands in the current session. In PowerShell 2.0, it
-gets only commands in the current session.
+Starting in PowerShell 3.0, by default, `Get-Command` gets all installed commands, including, but
+not limited to, the commands in the current session. In PowerShell 2.0, it gets only commands in the
+current session.
This parameter was introduced in Windows PowerShell 3.0.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](About/about_CommonParameters.md).
-## INPUTS
+## Inputs
### System.String You can pipe command names to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.CommandInfo
Represents cmdlets.
Represents functions and filters.
-## NOTES
+## Notes
-* When more than one command that has the same name is available to the session, `Get-Command`
+- When more than one command that has the same name is available to the session, `Get-Command`
returns the command that runs when you type the command name. To get commands that have the same name, listed in run order, use the **All** parameter. For more information, see [about_Command_Precedence](../Microsoft.PowerShell.Core/About/about_Command_Precedence.md).
-* When a module is imported automatically, the effect is the same as using the `Import-Module`
+- When a module is imported automatically, the effect is the same as using the `Import-Module`
cmdlet. The module can add commands, types and formatting files, and run scripts in the session. To enable, disable, and configuration automatic importing of modules, use the `$PSModuleAutoLoadingPreference` preference variable. For more information, see [about_Preference_Variables](../Microsoft.PowerShell.Core/About/about_Preference_Variables.md).
-## RELATED LINKS
+## Related Links
[Export-PSSession](../Microsoft.PowerShell.Utility/Export-PSSession.md)
Represents functions and filters.
[Import-PSSession](../Microsoft.PowerShell.Utility/Import-PSSession.md) [about_Command_Precedence](About/about_Command_Precedence.md)-
Microsoft.PowerShell.Utility Get Member (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Get-Member.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 05/06/2020 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/get-member?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Get-Member --- # Get-Member
-## SYNOPSIS
+## Synopsis
Gets the properties and methods of objects.
-## SYNTAX
+## Syntax
``` Get-Member [-InputObject <PSObject>] [[-Name] <String[]>] [-MemberType <PSMemberTypes>] [-View <PSMemberViewTypes>] [-Static] [-Force] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Get-Member` cmdlet gets the members, the properties and methods, of objects.
information about static members, the members of the class, not of the instance,
parameter. To get only certain types of members, such as **NoteProperties**, use the **MemberType** parameter.
-## EXAMPLES
+## Examples
### Example 1: Get the members of process objects
LastWriteTimeUtc
Attributes ```
-## PARAMETERS
+## Parameters
### -Force Adds the intrinsic members and the compiler-generated **get_** and **set_** methods to the display. The following list describes the properties that are added when you use the **Force** parameter: -- **PSBase**: The original properties of the .NET object without extension or adaptation. These are
+- `PSBase`: The original properties of the .NET object without extension or adaptation. These are
the properties defined for the object class.-- **PSAdapted**. The properties and methods defined in the PowerShell extended type system.-- **PSExtended**. The properties and methods that were added in the `Types.ps1xml` files or by using
+- `PSAdapted`: The properties and methods defined in the PowerShell extended type system.
+- `PSExtended`: The properties and methods that were added in the `Types.ps1xml` files or by using
the `Add-Member` cmdlet.-- **PSObject**. The adapter that converts the base object to a PowerShell **PSObject** object.-- **PSTypeNames**. A list of object types that describe the object, in order of specificity. When
+- `PSObject`: The adapter that converts the base object to a PowerShell **PSObject** object.
+- `PSTypeNames`: A list of object types that describe the object, in order of specificity. When
formatting the object, PowerShell searches for the types in the `Format.ps1xml` files in the PowerShell installation directory (`$PSHOME`). It uses the formatting definition for the first type that it finds.
Accept wildcard characters: False
### -MemberType
-Specifies the member type that this cmdlet gets. The default is **All**.
+Specifies the member type that this cmdlet gets. The default is `All`.
The acceptable values for this parameter are: -- AliasProperty-- CodeProperty-- Property-- NoteProperty-- ScriptProperty-- Properties-- PropertySet-- Method-- CodeMethod-- ScriptMethod-- Methods-- ParameterizedProperty-- MemberSet-- Event-- Dynamic-- All
+- `AliasProperty`
+- `CodeProperty`
+- `Property`
+- `NoteProperty`
+- `ScriptProperty`
+- `Properties`
+- `PropertySet`
+- `Method`
+- `CodeMethod`
+- `ScriptMethod`
+- `Methods`
+- `ParameterizedProperty`
+- `MemberSet`
+- `Event`
+- `Dynamic`
+- `All`
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **MemberType** parameter as
+an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
For information about these values, see [PSMemberTypes Enumeration](/dotnet/api/system.management.automation.psmembertypes). Not all objects have every type of member. If you specify a member type that the object does not
-have, PowerShell returns a null value.
-
-To get related types of members, such as all extended members, use the **View** parameter. If you
-use the **MemberType** parameter with the **Static** or **View** parameters, `Get-Member` gets the
-members that belong to both sets.
+have, PowerShell returns a null value. To get related types of members, such as all extended
+members, use the **View** parameter. If you use the **MemberType** parameter with the **Static** or
+**View** parameters, `Get-Member` gets the members that belong to both sets.
```yaml Type: System.Management.Automation.PSMemberTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Management.Automation.PSObject You can pipe any object to `Get-Member`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.MemberDefinition `Get-Member` returns an object for each property or method that its gets.
-## NOTES
+## Notes
You can get information about a collection object either by using the **InputObject** parameter or by piping the object, preceded by a comma, to `Get-Member`.
return information about the `[System.RuntimeType]` type. However, when you use
parameter, `Get-Member` returns the static members of the specific type represented by the `System.RuntimeType` instance.
-## RELATED LINKS
+## Related Links
[Add-Member](Add-Member.md)-
Microsoft.PowerShell.Utility Import Pssession (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Import-PSSession.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 06/09/2017 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/import-pssession?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Import-PSSession --- # Import-PSSession
-## SYNOPSIS
+## Synopsis
Imports commands from another session into the current session.
-## SYNTAX
+## Syntax
``` Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <String[]>] [-AllowClobber]
Import-PSSession [-Prefix <String>] [-DisableNameChecking] [[-CommandName] <Stri
[-Certificate <X509Certificate2>] [-Session] <PSSession> [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Import-PSSession` cmdlet imports commands , such as cmdlets, functions, and aliases, from a PSSession on a local or remote computer into the current session. You can import any command that
Beginning in Windows PowerShell 3.0, you can use the `Import-Module` cmdlet to i
remote session into the current session. This feature uses implicit remoting. It is equivalent to using `Import-PSSession` to import selected modules from a remote session into the current session.
-## EXAMPLES
+## Examples
### Example 1: Import all commands from a PSSession ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S
``` This command imports all commands from a PSSession on the Server01 computer into the current
formatting data required for the imported commands.
### Example 2: Import commands that end with a specific string ```
-PS C:\> $S = New-PSSession https://ps.testlabs.com/powershell
-PS C:\> Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
-PS C:\> New-Test -Name Test1
-PS C:\> Get-Test test1 | Run-Test
+$S = New-PSSession https://ps.testlabs.com/powershell
+Import-PSSession -Session $S -CommandName *-test -FormatTypeName *
+New-Test -Name Test1
+Get-Test test1 | Run-Test
``` These commands import the commands with names that end in "-test" from a PSSession into the local
need to use the `Invoke-Command` cmdlet to run an imported command.
### Example 3: Import cmdlets from a PSSession ```
-PS C:\> $S1 = New-PSSession -ComputerName s1
-PS C:\> $S2 = New-PSSession -ComputerName s2
-PS C:\> Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
-PS C:\> Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
-PS C:\> New-Test Test1 | Set-Test -RunType Full
+$S1 = New-PSSession -ComputerName s1
+$S2 = New-PSSession -ComputerName s2
+Import-PSSession -Session s1 -Type cmdlet -Name New-Test, Get-Test -FormatTypeName *
+Import-PSSession -Session s2 -Type Cmdlet -Name Set-Test -FormatTypeName *
+New-Test Test1 | Set-Test -RunType Full
``` This example shows that you can use imported cmdlets just as you would use local cmdlets.
cmdlet to another without error.
### Example 4: Run an imported command as a background job ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
-PS C:\> $batch = New-Test -Name Batch -AsJob
-PS C:\> Receive-Job $batch
+$S = New-PSSession -ComputerName Server01
+Import-PSSession -Session $S -CommandName *-test* -FormatTypeName *
+$batch = New-Test -Name Batch -AsJob
+Receive-Job $batch
``` This example shows how to run an imported command as a background job.
variable.
### Example 5: Import cmdlets and functions from a Windows PowerShell module ```
-PS C:\> $S = New-PSSession -ComputerName Server01
-PS C:\> Invoke-Command -Session $S {Import-Module TestManagement}
-PS C:\> Import-PSSession -Session $S -Module TestManagement
+$S = New-PSSession -ComputerName Server01
+Invoke-Command -Session $S {Import-Module TestManagement}
+Import-PSSession -Session $S -Module TestManagement
``` This example shows how to import the cmdlets and functions from a Windows PowerShell module on a
which returns the module name.
The `Get-Command` command is the equivalent of `Get-Command $M.Name`".
-## PARAMETERS
+## Parameters
### -AllowClobber
Accept wildcard characters: False
Specifies the type of command objects. The default value is Cmdlet. Use **CommandType** or its alias, **Type**. The acceptable values for this parameter are: -- Alias. The Windows PowerShell aliases in the remote session.-- All. The cmdlets and functions in the remote session.-- Application. All the files other than Windows-PowerShell files in the paths that are listed in the
- Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
+- `Alias`: The Windows PowerShell aliases in the remote session.
+- `All`: The cmdlets and functions in the remote session.
+- `Application`: All the files other than Windows-PowerShell files in the paths that are listed in
+ the Path environment variable (`$env:path`) in the remote session, including .txt, .exe, and .dll
files.-- Cmdlet. The cmdlets in the remote session. "Cmdlet" is the default.-- ExternalScript. The .ps1 files in the paths listed in the Path environment variable (`$env:path`)
- in the remote session.
-- Filter and Function. The Windows PowerShell functions in the remote session.-- Script. The script blocks in the remote session.
+- `Cmdlet`: The cmdlets in the remote session. "Cmdlet" is the default.
+- `ExternalScript`: The .ps1 files in the paths listed in the Path environment variable
+ (`$env:path`) in the remote session.
+- `Filter` and `Function`: The Windows PowerShell functions in the remote session.
+- `Script`: The script blocks in the remote session.
+
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **CommandType** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values.
```yaml Type: System.Management.Automation.CommandTypes
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### None You cannot pipe objects to this cmdlet.
-## OUTPUTS
+## Outputs
### System.Management.Automation.PSModuleInfo
You cannot pipe objects to this cmdlet.
However, the imported module is temporary and exists only in the current session. To create a permanent module on disk, use the `Export-PSSession` cmdlet.
-## NOTES
+## Notes
- `Import-PSSession` relies on the PowerShell remoting infrastructure. To use this cmdlet, the computer must be configured for WS-Management remoting. For more information, see
permanent module on disk, use the `Export-PSSession` cmdlet.
include the prefix that you assign by using the **Prefix** parameter. To get help for an imported command in Windows PowerShell 2.0, use the original (non-prefixed) command name.
-## RELATED LINKS
+## Related Links
[Export-PSSession](Export-PSSession.md)
Microsoft.PowerShell.Utility Invoke Webrequest (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Utility/Invoke-WebRequest.md
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Utility Previously updated : 01/26/2021 Last updated : 04/05/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Invoke-WebRequest
Title: Invoke-WebRequest
# Invoke-WebRequest
-## SYNOPSIS
+## Synopsis
Gets content from a web page on the internet.
-## SYNTAX
+## Syntax
### StandardMethod (Default)
Invoke-WebRequest [-UseBasicParsing] [-Uri] <Uri> [-WebSession <WebRequestSessio
[-PreserveAuthorizationOnRedirect] [-SkipHeaderValidation] [<CommonParameters>] ```
-## DESCRIPTION
+## Description
The `Invoke-WebRequest` cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements.
This cmdlet was introduced in PowerShell 3.0.
Beginning in PowerShell 7.0, `Invoke-WebRequest` supports proxy configuration defined by environment variables. See the [Notes](#notes) section of this article.
-## EXAMPLES
+## Examples
### Example 1: Send a web request
$StatusCode
The terminating error is caught by the `catch` block, which retrieves the **StatusCode** from the **Exception** object.
-## PARAMETERS
+## Parameters
### -AllowUnencryptedAuthentication
Specifies the explicit authentication type to use for the request. The default i
Available Authentication Options: -- **None**: This is the default option when **Authentication** isn't supplied; no explicit
+- `None`: This is the default option when **Authentication** isn't supplied; no explicit
authentication is used.-- **Basic**: Requires **Credential**. The credentials are sent in an RFC 7617 Basic Authentication
+- `Basic`: Requires **Credential**. The credentials are sent in an RFC 7617 Basic Authentication
header in the format of `base64(user:password)`.-- **Bearer**: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
+- `Bearer`: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
token. This is an alias for **OAuth**-- **OAuth**: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
+- `OAuth`: Requires **Token**. Sends an RFC 6750 `Authorization: Bearer` header with the supplied
token. This is an alias for **Bearer** Supplying **Authentication** overrides any `Authorization` headers supplied to **Headers** or
Accept wildcard characters: False
Specifies the method used for the web request. The acceptable values for this parameter are: -- Default-- Delete-- Get-- Head-- Merge-- Options-- Patch-- Post-- Put-- Trace
+- `Default`
+- `Delete`
+- `Get`
+- `Head`
+- `Merge`
+- `Options`
+- `Patch`
+- `Post`
+- `Put`
+- `Trace`
The **CustomMethod** parameter can be used for Request Methods not listed above.
Sets the SSL/TLS protocols that are permissible for the web request. By default
protocols supported by the system are allowed. **SslProtocol** allows for limiting to specific protocols for compliance purposes.
-**SslProtocol** uses the **WebSslProtocol** Flag Enum. It is possible to supply more than one
-protocol using flag notation or combining multiple **WebSslProtocol** options with **bor**, however
-supplying multiple protocols is not supported on all platforms.
+These values are defined as a flag-based enumeration. You can combine multiple values together to
+set multiple flags using this parameter. The values can be passed to the **SslProtocol** parameter
+as an array of values or as a comma-separated string of those values. The cmdlet will combine the
+values using a binary-OR operation. Passing values as an array is the simplest option and also
+allows you to use tab-completion on the values. You may not be able to define multiple options on
+all platforms.
> [!NOTE] > On non-Windows platforms it may not be possible to supply `Tls` or `Tls12` as an option. Support
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
-## INPUTS
+## Inputs
### System.Object You can pipe the body of a web request to `Invoke-WebRequest`.
-## OUTPUTS
+## Outputs
### Microsoft.PowerShell.Commands.BasicHtmlWebResponseObject
-## NOTES
+## Notes
Beginning with PowerShell 6.0.0 `Invoke-WebRequest` supports basic parsing only.
The value of this property is determined by your platform:
The environment variables used for `DefaultProxy` initialization on Windows and Unix-based platforms are: -- ` HTTP_PROXY`: the hostname or IP address of the proxy server used on HTTP requests.
+- `HTTP_PROXY`: the hostname or IP address of the proxy server used on HTTP requests.
- `HTTPS_PROXY`: the hostname or IP address of the proxy server used on HTTPS requests. - `ALL_PROXY`: the hostname or IP address of the proxy server used on HTTP and HTTPS requests in case `HTTP_PROXY` or `HTTPS_PROXY` are not defined. - `NO_PROXY`: a comma-separated list of hostnames that should be excluded from proxying.
-## RELATED LINKS
+## Related Links
[Invoke-RestMethod](Invoke-RestMethod.md)