diff --git a/reference/4.0/ISE/Import-IseSnippet.md b/reference/4.0/ISE/Import-IseSnippet.md index 651cc6797c70..81cbb4a604f5 100644 --- a/reference/4.0/ISE/Import-IseSnippet.md +++ b/reference/4.0/ISE/Import-IseSnippet.md @@ -37,14 +37,14 @@ To view and use the imported snippets, from the Windows PowerShell ISEEdit menu, Imported snippets are available only in the current session. To import the snippets into all Windows PowerShell ISE sessions, add an **Import-IseSnippet** command to your Windows PowerShell profile or copy the snippet files to your local snippets directory ($home\Documents\WindowsPowershell\Snippets). -To be imported, the snippets must be properly formatted in the snippet XML for Windows PowerShell ISE snippets and saved in Snippet.ps1xml files. +To import snippets, they must be properly formatted in the snippet XML for Windows PowerShell ISE snippets and saved in Snippet.ps1xml files. To create eligible snippets, use the New-IseSnippet cmdlet. New-IseSnippet creates a \.Snippets.ps1xml file in the $home\Documents\WindowsPowerShell\Snippets directory. You can move or copy the snippets to the Snippets directory of a Windows PowerShell module, or to any other directory. -NOTE: The Get-IseSnippet cmdlet, which gets user-created snippets in the local snippets directory, does not get imported snippets. +The Get-IseSnippet cmdlet, which gets user-created snippets in the local snippets directory, does not get imported snippets. -This cmdlet is introduced in Windows PowerShell 3.0. +This cmdlet was introduced in Windows PowerShell 3.0. ## EXAMPLES @@ -198,4 +198,6 @@ This cmdlet does not generate output. [Get-IseSnippet](Get-IseSnippet.md) -[New-IseSnippet](New-IseSnippet.md) \ No newline at end of file +[New-IseSnippet](New-IseSnippet.md) + +[about_Execution_Policies](../Microsoft.PowerShell.Core/About/about_Execution_Policies.md) \ No newline at end of file diff --git a/reference/4.0/ISE/New-IseSnippet.md b/reference/4.0/ISE/New-IseSnippet.md index bfbc649f5a24..8d97752af840 100644 --- a/reference/4.0/ISE/New-IseSnippet.md +++ b/reference/4.0/ISE/New-IseSnippet.md @@ -34,17 +34,15 @@ To see snippets in Windows PowerShell ISE, from the **Edit** menu, select **Sta The **New-ISESnippet** cmdlet creates a \.Snippets.ps1xml file in the $home\Documents\WindowsPowerShell\Snippets directory with the title that you specify. To include a snippet file in a module that you are authoring, add the snippet file to a Snippets subdirectory of your module directory. -Note: You cannot use user-created snippets in a session in which the execution policy is AllSigned or Restricted. -For more information, see the Notes section. +You cannot use user-created snippets in a session in which the execution policy is **Restricted** or **AllSigned**. -This cmdlet is introduced in Windows PowerShell 3.0. +This cmdlet was introduced in Windows PowerShell 3.0. ## EXAMPLES -### Example 1 - -```powershell -New-IseSnippet -Title Comment-BasedHelp -Description "A template for comment-based help." -Text "<# +### Example 1: Create a Comment-BasedHelp snippet +``` +PS C:\> New-IseSnippet -Title Comment-BasedHelp -Description "A template for comment-based help." -Text "<# .SYNOPSIS .DESCRIPTION .PARAMETER @@ -58,10 +56,9 @@ New-IseSnippet -Title Comment-BasedHelp -Description "A template for comment-bas This command creates a Comment-BasedHelp snippet for Windows PowerShell ISE. It creates a file named "Comment-BasedHelp.snippets.ps1xml" in the user's Snippets directory ($home\Documents\WindowsPowerShell\Snippets). -### Example 2 - -```powershell -$m = @' +### Example 2: Create a mandatory snippet +``` +PS C:\> $M = @' Param ( [parameter(Mandatory=$true)] @@ -69,23 +66,23 @@ Param $ ) '@ -New-IseSnippet -Text $m -Title Mandatory -Description "Adds a mandatory function parameter." -Author "Kim Akers, Fabrikam Corp." -Force + +PS C:\> New-ISESnippet -Text $M -Title Mandatory -Description "Adds a mandatory function parameter." -Author "Patti Fuller, Fabrikam Corp." -Force ``` -These commands create a Mandatory snippet for Windows PowerShell ISE. -The first command saves the snippet text in the $m variable. +This example creates a Mandatory snippet for Windows PowerShell ISE. +The first command saves the snippet text in the $M variable. The second command uses the **New-ISESnippet** cmdlet to create the snippet. The command uses the **Force** parameter to overwrite a previous snippet with the same name. -### Example 3 - -```powershell -Copy-Item $home\Documents\WindowsPowerShell\Snippets\Mandatory.Snippets.ps1xml -Destination \\Server\Share +### Example 3: Copy a mandatory snippet from a folder to a destination folder +``` +PS C:\> Copy-Item "$Home\Documents\WindowsPowerShell\Snippets\Mandatory.Snippets.ps1xml" -Destination "\\Server\Share" ``` This command uses the Copy-Item cmdlet to copy the Mandatory snippet from the folder where **New-ISESnippet** places it to the Server\Share file share. -Because the Snippets.ps1xml files that **New-ISESnippet** creates are text (XML) files, you can use the Item cmdlets to get, changes, move, rename, and copy them. +Because the Snippets.ps1xml files that **New-ISESnippet** creates are text (XML) files, you can use the **Item** cmdlets to get, changes, move, rename, and copy them. ## PARAMETERS diff --git a/reference/4.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md b/reference/4.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md index a6d7f2239087..a187b02a113f 100644 --- a/reference/4.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md +++ b/reference/4.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md @@ -48,13 +48,15 @@ The **Enable-PSRemoting** cmdlet performs the following operations: To run this cmdlet, start Windows PowerShell with the "Run as administrator" option. -CAUTION: On systems that have both Windows PowerShell 3.0 and the Windows PowerShell 2.0 engine, do not use Windows PowerShell 2.0 to run the **Enable-PSRemoting** and Disable-PSRemoting cmdlets. -The commands might appear to succeed, but the remoting is not configured correctly. -Remote commands, and later attempts to enable and disable remoting, are likely to fail. +> [!CAUTION] +> On systems that have both Windows PowerShell 3.0 and the Windows PowerShell 2.0 engine, do not use +> Windows PowerShell 2.0 to run the **Enable-PSRemoting** and Disable-PSRemoting cmdlets. The commands +> might appear to succeed, but the remoting is not configured correctly. Remote commands, and later +> attempts to enable and disable remoting, are likely to fail. ## EXAMPLES -### Example 1 +### Example 1: Configure a computer to receive remote commands ```powershell Enable-PSRemoting @@ -62,16 +64,16 @@ Enable-PSRemoting This command configures the computer to receive remote commands. -### Example 2 +### Example 2: Configure a computer to receive remote commands without a confirmation prompt ```powershell Enable-PSRemoting -Force ``` This command configures the computer to receive remote commands. -It uses the Force parameter to suppress the user prompts. +It uses the *Force* parameter to suppress the user prompts. -### Example 3 +### Example 3: Allow remote access on clients ```powershell Enable-PSRemoting -SkipNetworkProfileCheck -Force @@ -90,7 +92,8 @@ The command uses the Force parameter to suppress confirmation messages. The **SkipNetworkProfileCheck** parameter has no effect on server version of Windows, which allow remote access from public networks in the same local subnet by default. The second command eliminates the subnet restriction. -The command uses the **Set-NetFirewallRule** cmdlet in the **NetSecurity** module to add a firewall rule that allows remote access from public networks from any remote location, including locations in different subnets. +The command uses the **Set-NetFirewallRule** cmdlet in the **NetSecurity** module to add a firewall rule that allows remote access from public networks from any remote location. +This includes locations in different subnets. ## PARAMETERS @@ -136,9 +139,8 @@ This parameter has no effect on server versions of Windows, which, by default, h If the local subnet firewall rule is disabled on a server version of Windows, **Enable-PSRemoting** re-enables it, regardless of the value of this parameter. To remove the local subnet restriction and enable remote access from all locations on public networks, use the **Set-NetFirewallRule** cmdlet in the **NetSecurity** module. -For more information, see Notes and Examples. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: SwitchParameter @@ -183,7 +185,7 @@ You cannot pipe input to this cmdlet. ### System.String -Enable-PSRemoting returns strings that describe its results. +This cmdlet returns strings that describe its results. ## NOTES diff --git a/reference/4.0/Microsoft.PowerShell.Core/Get-Module.md b/reference/4.0/Microsoft.PowerShell.Core/Get-Module.md index 52757b597307..313b8caaedd1 100644 --- a/reference/4.0/Microsoft.PowerShell.Core/Get-Module.md +++ b/reference/4.0/Microsoft.PowerShell.Core/Get-Module.md @@ -213,7 +213,7 @@ Name ModuleType Path BitsTransfer Manifest C:\Windows\system32\WindowsPowerShell\v1.0\Modules\BitsTransfer\BitsTransfer.psd1 ``` -This command gets all module files (imported and available) and groups them by module name. +This command gets all module files, both imported and available, and then groups them by module name. This lets you see the module files that each script is exporting. ### Example 7: Display the contents of a module manifest @@ -353,7 +353,7 @@ The default value is the namespace of the Module Discovery WMI provider. Use this parameter to get CIM modules from computers and devices that are not running a Windows operating system. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: String @@ -372,9 +372,9 @@ Accept wildcard characters: False Specifies an alternate location for CIM modules. The default value is the resource URI of the Module Discovery WMI provider on the remote computer. -Use this parameter to get CIM modules from computers and devices that are not running a Windows operating system. +Use this parameter to get CIM modules from computers and devices that are not running the Windows operating system. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: Uri @@ -394,9 +394,9 @@ Specifies a CIM session on the remote computer. Enter a variable that contains the CIM session or a command that gets the CIM session, such as a [Get-CimSession](https://docs.microsoft.com/powershell/module/cimcmdlets/get-cimsession) command. `Get-Module` uses the CIM session connection to get modules from the remote computer. -When you import the module (by using the `Import-Module` cmdlet) and use the commands from the imported module in the current session, the commands actually run on the remote computer. +When you import the module by using the `Import-Module` cmdlet and use the commands from the imported module in the current session, the commands actually run on the remote computer. -You can use this parameter to get modules from computers and devices that are not running a Windows operating system, and Windows computers that have Windows PowerShell, but do not have Windows PowerShell remoting enabled. +You can use this parameter to get modules from computers and devices that are not running the Windows operating system, and computers that have Windows PowerShell, but do not have Windows PowerShell remoting enabled. The **CimSession** parameter gets all modules in the **CIMSession**. However, you can import only CIM-based and Cmdlet Definition XML (CDXML)-based modules. @@ -415,7 +415,8 @@ Accept wildcard characters: False ### -FullyQualifiedName -Gets modules with names that are specified in the form of **ModuleSpecification** objects (described in the Remarks section of [ModuleSpecification Constructor (Hashtable)](https://msdn.microsoft.com/library/jj136290) in the MSDN library). +Specifies names of modules in the form of **ModuleSpecification** objects. +These objects are described in the Remarks section of [ModuleSpecification Constructor (Hashtable)](https://msdn.microsoft.com/library/jj136290) in the MSDN library. For example, the **FullyQualifiedName** parameter accepts a module name that is specified in the following formats: - @{ModuleName = "modulename"; ModuleVersion = "version_number"} @@ -423,7 +424,7 @@ For example, the **FullyQualifiedName** parameter accepts a module name that is **ModuleName** and **ModuleVersion** are required, but **Guid** is optional. -You cannot specify the **FullyQualifiedName** parameter in the same command as a **Name** parameter; the two parameters are mutually exclusive. +You cannot specify the **FullyQualifiedName** parameter in the same command as a **Name** parameter. ```yaml Type: ModuleSpecification[] @@ -432,7 +433,7 @@ Aliases: Required: False Position: Named -Default value: All imported or available modules. +Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` @@ -470,12 +471,13 @@ Accept wildcard characters: False ### -Name -Gets only modules with the specified names or name patterns. -Wildcards are permitted. +Specifies names or name patterns of modules that this cmdlet gets. +Wildcard characters are permitted. You can also pipe the names to `Get-Module`. -You cannot specify the **FullyQualifiedName** parameter in the same command as a **Name** parameter; the two parameters are mutually exclusive. +You cannot specify the **FullyQualifiedName** parameter in the same command as a **Name** parameter. -The **Name** parameter cannot accept a module GUID as a value; to return modules by specifying a GUID, use the **FullyQualifiedName** parameter instead of the **Name** parameter. +**Name** cannot accept a module GUID as a value. +To return modules by specifying a GUID, use **FullyQualifiedName** instead. ```yaml Type: String[] @@ -484,7 +486,7 @@ Aliases: Required: False Position: 0 -Default value: All imported or available modules. +Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -498,7 +500,7 @@ When the session is connected to a remote computer, the **ListAvailable** parame A `Get-Module` command with the **PSSession** parameter is equivalent to using the `Invoke-Command` cmdlet to run a `Get-Module -ListAvailable` command in a **PSSession**. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: PSSession @@ -522,7 +524,7 @@ This parameter is designed for development and testing scenarios in which the co When the **Refresh** parameter is used in a command, the **ListAvailable** parameter is required. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: SwitchParameter @@ -544,14 +546,14 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### System.String -You can pipe module names to `Get-Module`. +You can pipe module names to this cmdlet. ## OUTPUTS ### System.Management.Automation.PSModuleInfo -`Get-Module` returns objects that represent modules. -When you use the **ListAvailable** parameter, `Get-Module` returns a **ModuleInfoGrouping** object, which is a type of **PSModuleInfo** object that has the same properties and methods. +This cmdlet returns objects that represent modules. +When you specify the **ListAvailable** parameter, `Get-Module` returns a **ModuleInfoGrouping** object, which is a type of **PSModuleInfo** object that has the same properties and methods. ## NOTES @@ -568,9 +570,10 @@ When you use the **ListAvailable** parameter, `Get-Module` returns a **ModuleInf - To use the CIM session feature, the remote computer must have WS-Management remoting and Windows Management Instrumentation (WMI), which is the Microsoft implementation of the Common Information Model (CIM) standard. The computer must also have the Module Discovery WMI provider or an alternate WMI provider that has the same basic features. - You can use the CIM session feature on computers that are not running a Windows operating system and on Windows computers that have Windows PowerShell, but do not have Windows PowerShell remoting enabled. + You can use the CIM session feature on computers that are not running the Windows operating system and on Windows computers that have Windows PowerShell, but do not have Windows PowerShell remoting enabled. - You can also use the CIM parameters to get CIM modules from computers that have Windows PowerShell remoting enabled, including the local computer. + You can also use the CIM parameters to get CIM modules from computers that have Windows PowerShell remoting enabled. +This includes the local computer. When you create a CIM session on the local computer, Windows PowerShell uses DCOM, instead of WMI, to create the session. ## RELATED LINKS diff --git a/reference/4.0/Microsoft.PowerShell.Core/Invoke-Command.md b/reference/4.0/Microsoft.PowerShell.Core/Invoke-Command.md index 0a90d5d6fc52..83df6106321b 100644 --- a/reference/4.0/Microsoft.PowerShell.Core/Invoke-Command.md +++ b/reference/4.0/Microsoft.PowerShell.Core/Invoke-Command.md @@ -61,16 +61,6 @@ Invoke-Command [[-ComputerName] ] [-Credential ] [-Port ### Uri -``` -Invoke-Command [-Credential ] [-ConfigurationName ] [-ThrottleLimit ] - [[-ConnectionUri] ] [-AsJob] [-InDisconnectedSession] [-HideComputerName] [-JobName ] - [-ScriptBlock] [-AllowRedirection] [-SessionOption ] - [-Authentication ] [-EnableNetworkAccess] [-InputObject ] - [-ArgumentList ] [-CertificateThumbprint ] [] -``` - -### Uri - ``` Invoke-Command [-Credential ] [-ConfigurationName ] [-ThrottleLimit ] [[-ConnectionUri] ] [-AsJob] [-InDisconnectedSession] [-HideComputerName] [-JobName ] diff --git a/reference/4.0/Microsoft.PowerShell.Core/Receive-PSSession.md b/reference/4.0/Microsoft.PowerShell.Core/Receive-PSSession.md index 3d79c3010bc7..807b6593014d 100644 --- a/reference/4.0/Microsoft.PowerShell.Core/Receive-PSSession.md +++ b/reference/4.0/Microsoft.PowerShell.Core/Receive-PSSession.md @@ -81,20 +81,21 @@ Receive-PSSession [-Name] [-OutTarget ] [-JobName ] ## DESCRIPTION -The **Receive-PSSession** cmdlet gets the results of commands running in Windows PowerShell sessions ("PSSession") that were disconnected. +The **Receive-PSSession** cmdlet gets the results of commands running in Windows PowerShell sessions (**PSSession**) that were disconnected. If the session is currently connected, **Receive-PSSession** gets the results of commands that were running when the session was disconnected. If the session is still disconnected, **Receive-PSSession** connects to the session, resumes any commands that were suspended, and gets the results of commands running in the session. -You can use a **Receive-PSSession** in addition to or in place of a Connect-PSSession command. -**Receive-PSSession** can connect to any disconnected or reconnected session, including those that were started in other sessions or on other computers. +You can use a **Receive-PSSession** in addition to or instead of a Connect-PSSession command. +**Receive-PSSession** can connect to any disconnected or reconnected session. +These includes those that were started in other sessions or on other computers. -**Receive-PSSession** works on PSSessions that were disconnected intentionally, such as by using the Disconnect-PSSession cmdlet or the **InDisconnectedSession** parameter of the Invoke-Command cmdlet, or unintentionally, such as by a network interruption. +**Receive-PSSession** works on **PSSessions** that were disconnected intentionally, such as by using the Disconnect-PSSession cmdlet or the *InDisconnectedSession* parameter of the Invoke-Command cmdlet, or unintentionally, such as by a network interruption. If you use the **Receive-PSSession** cmdlet to connect to a session in which no commands are running or suspended, **Receive-PSSession** connects to the session, but returns no output or errors. For more information about the Disconnected Sessions feature, see [about_Remote_Disconnected_Sessions](./About/about_Remote_Disconnected_Sessions.md). -This cmdlet is introduced in Windows PowerShell 3.0. +This cmdlet was introduced in Windows PowerShell 3.0. ## EXAMPLES @@ -384,7 +385,7 @@ Accept wildcard characters: False Connects only to sessions that use the specified session configuration. Enter a configuration name or the fully qualified resource URI for a session configuration. -If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. +If you specify only the configuration name, the following schema URI is prepended: `http://schemas.microsoft.com/powershell`. The configuration name of a session is stored in the **ConfigurationName** property of the session. The value of this parameter is used to select and filter sessions. @@ -420,12 +421,12 @@ Accept wildcard characters: False ``` ### -ConnectionUri -Specifies a Uniform Resource Identifier (URI) that defines the connection endpoint that is used to reconnect to the disconnected session. +Specifies a URI that defines the connection endpoint that is used to reconnect to the disconnected session. The URI must be fully qualified. The format of this string is as follows: -`\://\:\/\` +`://:/` The default value is as follows: @@ -446,7 +447,7 @@ Aliases: URI, CU Required: True Position: 0 -Default value: Http://localhost:5985/WSMAN +Default value: http://localhost:5985/WSMAN Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` @@ -475,7 +476,7 @@ Accept wildcard characters: False ### -Id Specifies the ID of the disconnected session. -The ID parameter works only when the disconnected session was previously connected to the current session. +The *Id* parameter works only when the disconnected session was previously connected to the current session. This parameter is valid, but not effective, when the session is stored on the local computer, but was not connected to the current session. diff --git a/reference/4.0/Microsoft.PowerShell.Management/Get-WmiObject.md b/reference/4.0/Microsoft.PowerShell.Management/Get-WmiObject.md index 5330cd9cdcfc..d4f72e02c5bc 100644 --- a/reference/4.0/Microsoft.PowerShell.Management/Get-WmiObject.md +++ b/reference/4.0/Microsoft.PowerShell.Management/Get-WmiObject.md @@ -75,14 +75,16 @@ This makes it easier to include the source computer name in output and reports. ## EXAMPLES -### Example 1 +### Example 1: Get processes on the local computer + ``` PS C:\> Get-WmiObject -Class Win32_Process ``` This command get the processes on the local computer. -### Example 2 +### Example 2: Gets services on a remote computer + ``` PS C:\> Get-WmiObject -Class Win32_Service -ComputerName 127.0.0.1 ``` @@ -91,14 +93,16 @@ This command gets the services on a remote computer. It uses the ComputerName parameter to specify the Internet Protocol (IP) address, 127.0.0.1. By default, the current account must be a member of the Administrators group on the remote computer. -### Example 3 +### Example 3: Get WMI classes in the root or default namespace of the local computer + ``` PS C:\> Get-WmiObject -Namespace "root/default" -List ``` This command gets the WMI classes in the root or default namespace of the local computer. -### Example 4 +### Example 4: Get a named service on multiple computers + ``` PS C:\> Get-WmiObject -Query "select * from win32_service where name='WinRM'" -ComputerName Server01, Server02 | Format-List -Property PSComputerName, Name, ExitCode, Name, ProcessID, StartMode, State, Status @@ -129,7 +133,8 @@ This makes it easy to see the computer on which the service resides. **PSComputerName** is an alias of the **__Server** property of the objects that **Get-WmiObject** returns. This alias is introduced in Windows PowerShell 3.0. -### Example 5 +### Example 5: Stop a service on a remote computer + ``` PS C:\> (Get-WmiObject -Class Win32_Service -Filter "name='WinRM'" -ComputerName Server01).StopService() ``` @@ -140,7 +145,8 @@ Then, it invokes the **StopService** method of the Win32_Service WMI class on th This command is an alternative to using the Stop-Service cmdlet. -### Example 6 +### Example 6: Get the BIOS on the local computer + ``` PS C:\> Get-WmiObject -Class Win32_Bios | Format-List -Property @@ -196,9 +202,10 @@ This command gets the BIOS on the local computer. The command uses a value of all (*) for the Property parameter of the Format-List cmdlet to display all properties of the returned object in a list. By default, only a subset (defined in the Types.ps1xml configuration file) are displayed. -### Example 7 +### Example 7: Get the services on a remote computer + ``` -PS C:\> Get-WmiObject Win32_Service -Credential FABRIKAM\administrator Computer Fabrikam +PS C:\> Get-WmiObject Win32_Service -Credential FABRIKAM\administrator -Computer Fabrikam ``` This command uses the **Credential** parameter of the **Get-WmiObject** cmdlet to get the services on a remote computer. @@ -252,6 +259,7 @@ Accept wildcard characters: False ``` ### -Authentication + Specifies the authentication level to be used with the WMI connection. Valid values are: @@ -278,6 +286,7 @@ Accept wildcard characters: False ``` ### -Authority + Specifies the authority to use to authenticate the WMI connection. You can specify standard NTLM or Kerberos authentication. To use NTLM, set the authority setting to ntlmdomain:\, where \ identifies a valid NTLM domain name. @@ -297,6 +306,7 @@ Accept wildcard characters: False ``` ### -Class + Specifies the name of a WMI class. When this parameter is used, the cmdlet retrieves instances of the WMI class. @@ -325,8 +335,9 @@ Accept wildcard characters: False ``` ### -ComputerName + Specifies the target computer for the management operation. -Enter a fully qualified domain name, a NetBIOS name, or an IP address. +Enter a fully qualified domain name (FQDN), a NetBIOS name, or an IP address. When the remote computer is in a different domain than the local computer, the fully qualified domain name is required. The default is the local computer. @@ -348,6 +359,7 @@ Accept wildcard characters: False ``` ### -Credential + Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as "User01", "Domain01\User01", or User@Contoso.com. @@ -367,6 +379,7 @@ Accept wildcard characters: False ``` ### -DirectRead + Specifies whether direct access to the WMI provider is requested for the specified class without any regard to its base class or to its derived classes. ```yaml @@ -382,6 +395,7 @@ Accept wildcard characters: False ``` ### -EnableAllPrivileges + Enables all the privileges of the current user before the command makes the WMI call. ```yaml @@ -397,6 +411,7 @@ Accept wildcard characters: False ``` ### -Filter + Specifies a **Where** clause to use as a filter. Uses the syntax of the WMI Query Language (WQL). @@ -420,23 +435,20 @@ Accept wildcard characters: False ``` ### -Impersonation + Specifies the impersonation level to use. -Valid values are: +The acceptable values for this parameter are: -0: Default. +- 0: Default. Reads the local registry for the default impersonation level , which is usually set to "3: Impersonate". - -1: Anonymous. +- 1: Anonymous. Hides the credentials of the caller. - -2: Identify. +- 2: Identify. Allows objects to query the credentials of the caller. - -3: Impersonate. +- 3: Impersonate. Allows objects to use the credentials of the caller. - -4: Delegate. +- 4: Delegate. Allows objects to permit other objects to use the credentials of the caller. ```yaml @@ -471,6 +483,7 @@ Accept wildcard characters: False ``` ### -Locale + Specifies the preferred locale for WMI objects. Enter a value in MS_\ format. @@ -487,6 +500,7 @@ Accept wildcard characters: False ``` ### -Namespace + When used with the **Class** parameter, the **Namespace** parameter specifies the WMI repository namespace where the specified WMI class is located. When used with the **List** parameter, it specifies the namespace from which to gather WMI class information. @@ -503,7 +517,8 @@ Accept wildcard characters: False ``` ### -Property -Gets the specified WMI class properties. + +Specifies the WMI class properties that this cmdlet gets information from. Enter the property names. ```yaml @@ -512,13 +527,14 @@ Parameter Sets: query Aliases: Required: False -Position: 2 +Position: 1 Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Query + Runs the specified WMI Query Language (WQL) statement. This parameter does not support event queries. @@ -535,6 +551,7 @@ Accept wildcard characters: False ``` ### -Recurse + Searches the current namespace and all other namespaces for the class name that is specified by the **Class** parameter. ```yaml @@ -550,6 +567,7 @@ Accept wildcard characters: False ``` ### -ThrottleLimit + Specifies the maximum number of WMI operations that can be executed simultaneously. This parameter is valid only when the **AsJob** parameter is used in the command. @@ -566,20 +584,24 @@ Accept wildcard characters: False ``` ### CommonParameters + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### None + You cannot pipe input to **Get-WmiObject**. ## OUTPUTS ### PSObject or System.Management.Automation.RemotingJob + When you use the **AsJob** parameter, the cmdlet returns a job object. Otherwise, the object that **Get-WmiObject** returns depends on the value of the **Class** parameter. ## NOTES + * To access WMI information on a remote computer, the cmdlet must run under an account that is a member of the local administrators group on the remote computer. Or, the default access control on the WMI namespace of the remote repository can be changed to give access rights to other accounts. Only some of the properties of each WMI class are displayed by default. diff --git a/reference/4.0/Microsoft.PowerShell.Security/Set-Acl.md b/reference/4.0/Microsoft.PowerShell.Security/Set-Acl.md index d4f73ca458be..ddb416234685 100644 --- a/reference/4.0/Microsoft.PowerShell.Security/Set-Acl.md +++ b/reference/4.0/Microsoft.PowerShell.Security/Set-Acl.md @@ -120,7 +120,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 2 +Position: 1 Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False @@ -228,7 +228,7 @@ Enter the CAP ID or friendly name of a central access policy on the computer. Beginning in Windows Server 2012, administrators can use Active Directory and Group Policy to set central access policies for users and groups. For more information, see [Dynamic Access Control: Scenario Overview](/windows-server/identity/solution-guides/dynamic-access-control--scenario-overview). -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: String @@ -236,7 +236,7 @@ Parameter Sets: ByPath, ByLiteralPath Aliases: Required: False -Position: 3 +Position: 2 Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -249,7 +249,7 @@ Removes the central access policy from the specified item. Beginning in Windows Server 2012, administrators can use Active Directory and Group Policy to set central access policies for users and groups. For more information, see [Dynamic Access Control: Scenario Overview](/windows-server/identity/solution-guides/dynamic-access-control--scenario-overview). -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: SwitchParameter @@ -271,7 +271,7 @@ Enter a variable that contains the object or a command that gets the object. You cannot pipe the object to be changed to `Set-Acl`. Instead, use the **InputObject** parameter explicitly in the command. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: PSObject @@ -293,7 +293,7 @@ No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences. -This parameter is introduced in Windows PowerShell 3.0. +This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: String[] diff --git a/reference/4.0/Microsoft.PowerShell.Utility/Get-Alias.md b/reference/4.0/Microsoft.PowerShell.Utility/Get-Alias.md index 947a38a31712..9c38523d6d58 100644 --- a/reference/4.0/Microsoft.PowerShell.Utility/Get-Alias.md +++ b/reference/4.0/Microsoft.PowerShell.Utility/Get-Alias.md @@ -31,17 +31,17 @@ Get-Alias [-Exclude ] [-Scope ] [-Definition ] ## DESCRIPTION -The Get-Alias cmdlet gets the aliases (alternate names for commands and executable files) in the current session. +The **Get-Alias** cmdlet gets the aliases in the current session. This includes built-in aliases, aliases that you have set or imported, and aliases that you have added to your Windows PowerShell profile. -By default, Get-Alias takes an alias and returns the command name. -When you use the Definition parameter, Get-Alias takes a command name and returns its aliases. +By default, **Get-Alias** takes an alias and returns the command name. +When you use the *Definition* parameter, **Get-Alias** takes a command name and returns its aliases. -Beginning in Windows PowerShell 3.0, Get-Alias displays non-hyphenated alias names in an "\ -\> \" format to make it even easier to find the information that you need. +Beginning in Windows PowerShell 3.0, **Get-Alias** displays non-hyphenated alias names in an ` -> ` format to make it even easier to find the information that you need. ## EXAMPLES -### Example 1 +### Example 1: Get all aliases in the current session ``` PS C:\> Get-Alias @@ -63,10 +63,10 @@ Alias clhy -> Clear-History This command gets all aliases in the current session. -The output shows the "\ -\> \" format that was introduced in Windows PowerShell 3.0. +The output shows the ` -> ` format that was introduced in Windows PowerShell 3.0. This format is used only for aliases that do not include hyphens, because aliases with hyphens are typically preferred names for cmdlets and functions, rather than nicknames. -### Example 2 +### Example 2: Get aliases by name ```powershell Get-Alias -Name gp*, sp* -Exclude *ps @@ -74,7 +74,7 @@ Get-Alias -Name gp*, sp* -Exclude *ps This command gets all aliases that begin with gp or sp, except for aliases that end with ps. -### Example 3 +### Example 3: Get aliases for a cmdlet ```powershell Get-Alias -Definition Get-ChildItem @@ -82,22 +82,22 @@ Get-Alias -Definition Get-ChildItem This command gets the aliases for the Get-ChildItem cmdlet. -By default, the Get-Alias cmdlet gets the item name when you know the alias. -The Definition parameter gets the alias when you know the item name. +By default, the **Get-Alias** cmdlet gets the item name when you know the alias. +The *Definition* parameter gets the alias when you know the item name. -### Example 4 +### Example 4: Get aliases by property ```powershell Get-Alias | Where-Object {$_.Options -Match "ReadOnly"} ``` -This command retrieves all aliases in which the value of the Options property is ReadOnly. +This command gets all aliases in which the value of the Options property is ReadOnly. This command provides a quick way to find the aliases that are built into Windows PowerShell, because they have the ReadOnly option. -Options is just one property of the AliasInfo objects that Get-Alias gets. -To find all properties and methods of AliasInfo objects, type "Get-Alias | get-member". +Options is just one property of the AliasInfo objects that **Get-Alias** gets. +To find all properties and methods of AliasInfo objects, type `Get-Alias | get-member`. -### Example 5 +### Example 5: Get aliases by name and filter by beginning letter ```powershell Get-Alias -Definition "*-PSSession" -Exclude e* -Scope Global @@ -105,7 +105,7 @@ Get-Alias -Definition "*-PSSession" -Exclude e* -Scope Global This example gets aliases for commands that have names that end in "-PSSession", except for those that begin with "e". -The command uses the Scope parameter to apply the command in the global scope. +The command uses the *Scope* parameter to apply the command in the global scope. This is useful in scripts when you want to get the aliases in the session. ## PARAMETERS @@ -115,7 +115,7 @@ This is useful in scripts when you want to get the aliases in the session. Gets the aliases for the specified item. Enter the name of a cmdlet, function, script, file, or executable file. -This parameter is called Definition, because it searches for the item name in the Definition property of the alias object. +This parameter is called *Definition*, because it searches for the item name in the Definition property of the alias object. ```yaml Type: String[] @@ -170,9 +170,15 @@ Accept wildcard characters: True ### -Scope -Gets only the aliases in the specified scope. -Valid values are "Global", "Local", or "Script", or a number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent). -"Local" is the default. +Specifies the scope for which this cmdlet gets aliases. +The acceptable values for this parameter are: + +- Global +- Local +- Script +- A number relative to the current scope (0 through the number of scopes, where 0 is the current scope and 1 is its parent) + +Local is the default. For more information, see about_Scopes. ```yaml @@ -195,14 +201,14 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### System.String -You can pipe alias names to Get-Alias. +You can pipe alias names to **Get-Alias**. ## OUTPUTS ### System.Management.Automation.AliasInfo -Get-Alias returns an object that represents each alias. -Get-Alias returns the same object for every alias, but Windows PowerShell uses an arrow-based format to display the names of non-hyphenated aliases. +**Get-Alias** returns an object that represents each alias. +**Get-Alias** returns the same object for every alias, but Windows PowerShell uses an arrow-based format to display the names of non-hyphenated aliases. ## NOTES diff --git a/reference/4.0/Microsoft.PowerShell.Utility/Select-Object.md b/reference/4.0/Microsoft.PowerShell.Utility/Select-Object.md index 7c096f56f26f..09f5421b4c3e 100644 --- a/reference/4.0/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/4.0/Microsoft.PowerShell.Utility/Select-Object.md @@ -267,6 +267,7 @@ Accept wildcard characters: True ### -ExpandProperty Specifies a property to select, and indicates that an attempt should be made to expand that property. +Wildcards are permitted in the property name. - If the specified property is an array, each value of the array is included in the output. - If the specified property is an object, the objects properties are expanded for every `InputObject` diff --git a/reference/5.0/CimCmdlets/Get-CimAssociatedInstance.md b/reference/5.0/CimCmdlets/Get-CimAssociatedInstance.md index 37635e01bcf1..c50b6d990ba9 100644 --- a/reference/5.0/CimCmdlets/Get-CimAssociatedInstance.md +++ b/reference/5.0/CimCmdlets/Get-CimAssociatedInstance.md @@ -27,14 +27,20 @@ Get-CimAssociatedInstance [[-Association] ] [-ResultClassName ] ``` ## DESCRIPTION -The Get-CimAssociatedInstance cmdlet retrieves the CIM instances connected to a specific CIM instance, called the source instance, by an association. +The Get-CimAssociatedInstance cmdlet retrieves the CIM instances connected to a specific CIM +instance, called the source instance, by an association. -In an association, each CIM instance has a named role and the same CIM instance can participate in an association in different roles. +In an association, each CIM instance has a named role and the same CIM instance can participate in +an association in different roles. -If the InputObject parameter is not specified, the cmdlet works in one of the following ways: +If the InputObject parameter is not specified, the cmdlet works in one of the following ways: ---If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet works on local Windows Management Instrumentation (WMI) using a Component Object Model (COM) session. ---If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet works against the CIM server specified by either the ComputerName parameter or the CimSession parameter. +- If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet + works on local Windows Management Instrumentation (WMI) using a Component Object Model (COM) + session. +- If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet + works against the CIM server specified by either the ComputerName parameter or the CimSession + parameter. ## EXAMPLES @@ -42,64 +48,58 @@ If the InputObject parameter is not specified, the cmdlet works in one of the fo ``` PS C:\>$disk = Get-CimInstance -ClassName Win32_LogicalDisk -KeyOnly - PS C:\>Get-CimAssociatedInstance -InputObject $disk[1] ``` -This set of commands retrieves the instances of the class named Win32_LogicalDisk and stores the information in a variable named $disk using the Get-CimInstance cmdlet. -The first logical disk instance in the variable is then used as the input object for the Get-CimAssociatedInstance cmdlet to get all the associated CIM instances of the specified CIM instance. +This set of commands retrieves the instances of the class named Win32_LogicalDisk and stores the +information in a variable named $disk using the Get-CimInstance cmdlet. The first logical disk +instance in the variable is then used as the input object for the Get-CimAssociatedInstance cmdlet +to get all the associated CIM instances of the specified CIM instance. ### Example 2: Get all the associated instances of a specific type ``` PS C:\>$disk = Get-CimInstance -ClassName Win32_LogicalDisk -KeyOnly - PS C:\>Get-CimAssociatedInstance -InputObject $disk[1] -ResultClass Win32_DiskPartition ``` -This set of commands retrieves all of the instances of the class named Win32_LogicalDisk and stores them in a variable named $disk. -The first logical disk instance in the variable is then used as the input object for the Get-CimAssociatedInstance cmdlet to get all the associated instances that are associated through the specified association class Win32_DiskPartition. +This set of commands retrieves all of the instances of the class named Win32_LogicalDisk and stores +them in a variable named $disk. The first logical disk instance in the variable is then used as the +input object for the Get-CimAssociatedInstance cmdlet to get all the associated instances that are +associated through the specified association class Win32_DiskPartition. ### Example 3: Get all the associated instances through qualifier of a specific class ``` -PS C:\>$s = Get-CimInstance -Query "Select * from Win32_Service where name like ꞌWinmgmtꞌ" - - +PS C:\>$s = Get-CimInstance -Query "Select * from Win32_Service where name like 'Winmgmt'" PS C:\>Get-CimClass -ClassName *Service* -Qualifier "Association" - - PS C:\>$c.CimClasName Win32_LoadOrderGroupServiceDependencies - - Win32_DependentService - - Win32_SystemServices - - Win32_LoadOrderGroupServiceMembers - - Win32_ServiceSpecificationService - PS C:\>Get-CimAssociatedInstance -InputObject $s -Association Win32_DependentService ``` -This set of commands retrieves the services that depend on Windows Management Instrumentation (WMI) service and stores them in a variable named $s. -The association class name for the Win32_DependentService is retrieved using the Get-CimClass cmdlet by specifying Association as the qualifier and is then passed with $s to the Get-CimAssociatedInstance cmdlet to get all the associated instances of the retrieved association class. +This set of commands retrieves the services that depend on Windows Management Instrumentation (WMI) +service and stores them in a variable named $s. The association class name for the +Win32_DependentService is retrieved using the Get-CimClass cmdlet by specifying Association as the +qualifier and is then passed with $s to the Get-CimAssociatedInstance cmdlet to get all the +associated instances of the retrieved association class. ## PARAMETERS ### -Association Specifies the name of the association class. -If you do not specify this parameter, the cmdlet returns all existing association objects irrespective of their type. +If you do not specify this parameter, the cmdlet returns all existing association objects +irrespective of their type. -For example, if class A is associated with class B through two associations, AB1 and AB2, then this parameter can be used to specify the type of association, either AB1 or AB2. +For example, if class A is associated with class B through two associations, AB1 and AB2, then this +parameter can be used to specify the type of association, either AB1 or AB2. ```yaml Type: String @@ -114,9 +114,9 @@ Accept wildcard characters: False ``` ### -CimSession -Runs the command using the specified CIM session. -Enter a variable that contains the CIM session, or a command that creates or gets the CIM session, such as New-CimSession or Get-CimSession. -For more information, see about_CimSessions. +Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or +a command that creates or gets the CIM session, such as New-CimSession or Get-CimSession. For more +information, see about_CimSessions. ```yaml Type: CimSession[] @@ -134,11 +134,14 @@ Accept wildcard characters: False Specifies the name of the computer on which you want to run the CIM operation. You can specify a fully qualified domain name (FQDN) or a NetBIOS name. -If you specify this parameter, the cmdlet creates a temporary session to the specified computer using the WsMan protocol. +If you specify this parameter, the cmdlet creates a temporary session to the specified computer +using the WsMan protocol. -If you do not specify this parameter, the cmdlet performs the operation on the local computer using Component Object Model (COM). +If you do not specify this parameter, the cmdlet performs the operation on the local computer using +Component Object Model (COM). -If multiple operations are being performed on the same computer, connecting using a CIM session gives better performance. +If multiple operations are being performed on the same computer, connecting using a CIM session +gives better performance. ```yaml Type: String[] @@ -189,7 +192,10 @@ Accept wildcard characters: False Specifies the namespace for the CIM operation. The default namespace is root/cimv2. -NOTE: You can use tab completion to browse the list of namespaces, because Windows PowerShell gets a list of namespaces from the local WMI server to provide the list of namespaces. + +> [!NOTE] +> You can use tab completion to browse the list of namespaces, because Windows PowerShell gets a +> list of namespaces from the local WMI server to provide the list of namespaces. ```yaml Type: String @@ -206,9 +212,12 @@ Accept wildcard characters: False ### -OperationTimeoutSec Specifies the amount of time that the cmdlet waits for a response from the computer. -By default, the value of this parameter is 0, which means that the cmdlet uses the default timeout value for the server. +By default, the value of this parameter is 0, which means that the cmdlet uses the default timeout +value for the server. -If the OperationTimeoutSec parameter is set to a value less than the robust connection retry timeout of 3 minutes, network failures that last more than the value of the OperationTimeoutSec parameter are not recoverable, because the operation on the server times out before the client can reconnect. +If the OperationTimeoutSec parameter is set to a value less than the robust connection retry timeout +of 3 minutes, network failures that last more than the value of the OperationTimeoutSec parameter +are not recoverable, because the operation on the server times out before the client can reconnect. ```yaml Type: UInt32 @@ -223,21 +232,26 @@ Accept wildcard characters: False ``` ### -ResourceUri -Specifies the resource uniform resource identifier (URI) of the resource class or instance. -The URI is used to identify a specific type of resource, such as disks or processes, on a computer. +Specifies the resource uniform resource identifier (URI) of the resource class or instance. The URI +is used to identify a specific type of resource, such as disks or processes, on a computer. A URI consists of a prefix and a path to a resource. For example: -http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk -http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings +- `http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk` +- `http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings` -By default, if you do not specify this parameter, the DMTF standard resource URI http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/ is used and the class name is appended to it. +By default, if you do not specify this parameter, the DMTF standard resource URI +`http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/` is used and the class name is appended to it. -ResourceURI can only be used with CIM sessions created using the WSMan protocol, or when specifying the ComputerName parameter, which creates a CIM session using WSMan. -If you specify this parameter without specifying the ComputerName parameter, or if you specify a CIM session created using DCOM protocol, you will get an error, because the DCOM protocol does not support the ResourceURI parameter. +ResourceURI can only be used with CIM sessions created using the WSMan protocol, or when specifying +the ComputerName parameter, which creates a CIM session using WSMan. If you specify this parameter +without specifying the ComputerName parameter, or if you specify a CIM session created using DCOM +protocol, you will get an error, because the DCOM protocol does not support the ResourceURI +parameter. -If both the ResourceUri parameter and the Filter parameter are specified, the Filter parameter is ignored. +If both the ResourceUri parameter and the Filter parameter are specified, the Filter parameter is +ignored. ```yaml Type: Uri @@ -276,8 +290,9 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/5.0/CimCmdlets/Get-CimSession.md b/reference/5.0/CimCmdlets/Get-CimSession.md index b92f714c7395..b8b34f3be90f 100644 --- a/reference/5.0/CimCmdlets/Get-CimSession.md +++ b/reference/5.0/CimCmdlets/Get-CimSession.md @@ -33,7 +33,7 @@ Get-CimSession -Name [] ``` ## DESCRIPTION -The Get-CimSession cmdlet gets the CIM session objects created in the current Windows PowerShell® session. +The Get-CimSession cmdlet gets the CIM session objects created in the current Windows PowerShell session. If used without any parameters, the cmdlet gets all of the CIM sessions created in the current Windows PowerShell session. You can use the parameters of Get-CimSession to get the sessions that are for particular computers, or you can identify sessions by their names, IDs, or instance IDs. diff --git a/reference/5.0/CimCmdlets/Invoke-CimMethod.md b/reference/5.0/CimCmdlets/Invoke-CimMethod.md index 1f937685928f..95eb019b58f2 100644 --- a/reference/5.0/CimCmdlets/Invoke-CimMethod.md +++ b/reference/5.0/CimCmdlets/Invoke-CimMethod.md @@ -107,16 +107,16 @@ If the InputObject parameter is specified, the cmdlet works in one of the follow ### Example 1: Invoke a method ```powershell -PS C:\>Invoke-CimMethod -Query ꞌselect * from Win32_Process where name like "notepad%"ꞌ -MethodName "Terminate" +PS C:\>Invoke-CimMethod -Query 'select * from Win32_Process where name like "notepad%"' -MethodName "Terminate" ``` This command invokes the method named Terminate on the CIM class named Win32_Process. The CIM class -is retrieved by the query "Select * from Win32_Process where name like ꞌnotepad%ꞌ". +is retrieved by the query "Select * from Win32_Process where name like 'notepad%'". ### Example 2: Invoke a method using CIM instance object ```powershell -PS C:\>$x = Get-CimInstance -Query ꞌSelect * from Win32_Process where name like "notepad%"ꞌ +PS C:\>$x = Get-CimInstance -Query 'Select * from Win32_Process where name like "notepad%"' PS C:\>Invoke-CimMethod -InputObject $x -MethodName GetOwner ``` @@ -135,7 +135,7 @@ This command invokes the static method Create on the class named Win32_Process, ### Example 4: Invoke a method using arguments ```powershell -PS C:\>Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ CommandLine = ꞌnotepad.exeꞌ; CurrentDirectory = "C:\windows\system32" } +PS C:\>Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ CommandLine = 'notepad.exe'; CurrentDirectory = "C:\windows\system32" } ``` This command invokes the method named Create by using the Arguments parameter. @@ -144,7 +144,7 @@ This command invokes the method named Create by using the Arguments parameter. ```powershell PS C:\>$c = Get-CimClass -ClassName Win32_Process -PS C:\>Invoke-CimMethod -CimClass $c -MethodName "xyz" -Arguments @{ CommandLine = ꞌnotepad.exeꞌ } +PS C:\>Invoke-CimMethod -CimClass $c -MethodName "xyz" -Arguments @{ CommandLine = 'notepad.exe' } ``` This set of commands performs client-side validation for the method named xyz by passing a CimClass diff --git a/reference/5.0/CimCmdlets/Remove-CimInstance.md b/reference/5.0/CimCmdlets/Remove-CimInstance.md index e27b87259a32..023fe70e3c10 100644 --- a/reference/5.0/CimCmdlets/Remove-CimInstance.md +++ b/reference/5.0/CimCmdlets/Remove-CimInstance.md @@ -41,16 +41,16 @@ The Remove-CimInstance cmdlet removes a CIM instance from a CIM server. You can specify the CIM instance to remove by using either a CIM instance object retrieved by the Get-CimInstance cmdlet, or by specifying a query. -If the InputObject parameter is not specified, the cmdlet works in one of the following ways: +If the InputObject parameter is not specified, the cmdlet works in one of the following ways: ---If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet works on local Windows Management Instrumentation (WMI) using a Component Object Model (COM) session. ---If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet works against the CIM server specified by either the ComputerName parameter or the CimSession parameter. +- If neither the ComputerName parameter nor the CimSession parameter is specified, then this cmdlet works on local Windows Management Instrumentation (WMI) using a Component Object Model (COM) session. +- If either the ComputerName parameter or the CimSession parameter is specified, then this cmdlet works against the CIM server specified by either the ComputerName parameter or the CimSession parameter. ## EXAMPLES ### Example 1: Remove the CIM instance ``` -PS C:\>Remove-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"ꞌ +PS C:\>Remove-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' ``` This command removes the CIM instances that start with the character string testvar from the class named Win32_Environment using the Query parameter. @@ -125,7 +125,7 @@ Accept wildcard characters: False ``` ### -InputObject -Specifies a CIM instance object to be removed from the CIM server. +Specifies a CIM instance object to be removed from the CIM server. Note: The input object passed to the cmdlet is not changed, only the instance in the CIM server is removed. ```yaml @@ -143,7 +143,7 @@ Accept wildcard characters: False ### -Namespace Specifies the namespace for the CIM operation. -The default namespace is root/cimv2. +The default namespace is root/cimv2. NOTE: You can use tab completion to browse the list of namespaces, because PowerShell gets a list of namespaces from the local WMI server to provide the list of namespaces. ```yaml @@ -220,13 +220,11 @@ Specifies the resource uniform resource identifier (URI) of the resource class o The URI is used to identify a specific type of resource, such as disks or processes, on a computer. A URI consists of a prefix and a path to a resource. -For example: +For example: -http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk -http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings +- `http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_LogicalDisk` +- `http://intel.com/wbem/wscim/1/amt-schema/1/AMT_GeneralSettings` - - By default, if you do not specify this parameter, the DMTF standard resource URI http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/ is used and the class name is appended to it. ResourceURI can only be used with CIM sessions created using the WSMan protocol, or when specifying the ComputerName parameter, which creates a CIM session using WSMan. diff --git a/reference/5.0/ISE/ISE.md b/reference/5.0/ISE/ISE.md index c8a9b4dafaf8..3971defe5fa3 100644 --- a/reference/5.0/ISE/ISE.md +++ b/reference/5.0/ISE/ISE.md @@ -13,7 +13,7 @@ Module Name: ISE ## Description -This section contains the help topics for the cmdlets that are installed with the Windows PowerShell® Integrated Scripting Environment (ISE) module. +This section contains the help topics for the cmdlets that are installed with the Windows PowerShell Integrated Scripting Environment (ISE) module. The Windows PowerShell ISE module contains cmdlets that add features to Windows PowerShell ISE. ## ISE Cmdlets diff --git a/reference/5.0/ISE/Import-IseSnippet.md b/reference/5.0/ISE/Import-IseSnippet.md index 2fcc4d32fe90..58ee527fce86 100644 --- a/reference/5.0/ISE/Import-IseSnippet.md +++ b/reference/5.0/ISE/Import-IseSnippet.md @@ -7,7 +7,6 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821535 external help file: ISE-help.xml title: Import-IseSnippet --- - # Import-IseSnippet ## SYNOPSIS @@ -16,19 +15,22 @@ Imports ISE snippets into the current session ## SYNTAX ### FromFolder (Default) + ``` Import-IseSnippet [-Path] [-Recurse] [] ``` ### FromModule + ``` Import-IseSnippet [-Recurse] -Module [-ListAvailable] [] ``` ## DESCRIPTION + The **Import-IseSnippet** cmdlet imports reusable text "snippets" from a module or a directory into the current session. The snippets are immediately available for use in Windows PowerShell ISE. -This cmdlet works only in Windows PowerShell® Integrated Scripting Environment (ISE). +This cmdlet works only in Windows PowerShell Integrated Scripting Environment (ISE). To view and use the imported snippets, from the Windows PowerShell ISEEdit menu, click Start Snippets or press Ctrl + J. @@ -47,39 +49,44 @@ This cmdlet was introduced in Windows PowerShell 3.0. ## EXAMPLES ### Example 1: Import snippets from a directory -``` -PS C:\> Import-IseSnippet -Path "\\Server01\Public\Snippets" -Recurse + +```powershell +Import-IseSnippet -Path \\Server01\Public\Snippets -Recurse ``` This command imports the snippets from the \\\\Server01\Public\Snippets directory into the current session. It uses the Recurse parameter to get snippets from all subdirectories of the Snippets directory. ### Example 2: Import snippets from a module -``` -PS C:\> Import-IseSnippet -Module "SnippetModule" -ListAvailable + +```powershell +Import-IseSnippet -Module SnippetModule -ListAvailable ``` This command imports the snippets from the SnippetModule module. The command uses the **ListAvailable** parameter to import the snippets even if the SnippetModule module is not imported into the user's session when the command runs. ### Example 3: Find snippets in modules -``` -PS C:\> ($env:PSModulePath).split(";") | foreach {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | foreach {$_.fullname} + +```powershell +($env:PSModulePath).split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | ForEach-Object {$_.fullname} ``` This command gets snippets in all installed modules in the PSModulePath environment variable. ### Example 4: Import all module snippets -``` -PS C:\> ($env:PSModulePath).split(";") | foreach {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | foreach {$psise.CurrentPowerShellTab.Snippets.Load($_)} + +```powershell +($env:PSModulePath).split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | ForEach-Object {$psise.CurrentPowerShellTab.Snippets.Load($_)} ``` This command imports all snippets from all installed modules into the current session. Typically, you don't need to run a command like this because modules that have snippets will use the **Import-IseSnippet** cmdlet to import them for you when the module is imported. ### Example 5: Copy all module snippets -``` -PS C:\> ($env:PSModulePath).split(";") | foreach {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | Copy-Item -Destination $home\Documents\WindowsPowerShell\Snippets + +```powershell +($env:PSModulePath).split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | Copy-Item -Destination $home\Documents\WindowsPowerShell\Snippets ``` This command copies the snippet files from all installed modules into the Snippets directory of the current user. @@ -118,7 +125,9 @@ Accept wildcard characters: False ``` ### -Module -Specifies the module into the current session that this cmdlet imports snippets from. + +Imports snippets from the specified module into the current session. +Wildcard characters are not supported. This parameter imports snippets from Snippet.ps1xml files in the Snippets subdirectory in the module path, such as $home\Documents\WindowsPowerShell\Modules\\\\Snippets. @@ -156,22 +165,26 @@ Accept wildcard characters: False ``` ### CommonParameters + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### None + This cmdlet does not take input from the pipeline. ## OUTPUTS ### None + This cmdlet does not generate output. ## NOTES -* You cannot use the Get-IseSnippet cmdlet to get imported snippets. **Get-IseSnippet** gets only snippets in the $home\Documents\WindowsPowerShell\Snippets directory. -* **Import-IseSnippet** uses the **Load** static method of **Microsoft.PowerShell.Host.ISE.ISESnippetCollection** objects. You can also use the **Load** method of snippets in the Windows PowerShell ISE object model: $psISE.CurrentPowerShellTab.Snippets.Load() -* The New-IseSnippet cmdlet stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot load them into a session in which the execution policy is **AllSigned** or **Restricted**. In a **Restricted** or **AllSigned** session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session. + +- You cannot use the Get-IseSnippet cmdlet to get imported snippets. **Get-IseSnippet** gets only snippets in the $home\Documents\WindowsPowerShell\Snippets directory. +- **Import-IseSnippet** uses the **Load** static method of Microsoft.PowerShell.Host.ISE.ISESnippetCollection objects. You can also use the Load method of snippets in the Windows PowerShell ISE object model: $psISE.CurrentPowerShellTab.Snippets.Load() +- The New-IseSnippet cmdlet stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot load them into a session in which the execution policy is **AllSigned** or **Restricted**. In a **Restricted** or **AllSigned** session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session. To use unsigned user-created snippets that the **Import-IseSnippet** cmdlet returns, change the execution policy, and then restart Windows PowerShell ISE. diff --git a/reference/5.0/ISE/New-IseSnippet.md b/reference/5.0/ISE/New-IseSnippet.md index 51493e982eee..65836b94764c 100644 --- a/reference/5.0/ISE/New-IseSnippet.md +++ b/reference/5.0/ISE/New-IseSnippet.md @@ -7,10 +7,10 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821536 external help file: ISE-help.xml title: New-IseSnippet --- - # New-IseSnippet ## SYNOPSIS + Creates a Windows PowerShell ISE code snippet. ## SYNTAX @@ -21,14 +21,15 @@ New-IseSnippet [-Title] [-Description] [-Text] [-Auth ``` ## DESCRIPTION -The **New-ISESnippet** cmdlet creates a reusable text "snippet" for Windows PowerShell® Integrated Scripting Environment (ISE). + +The **New-ISESnippet** cmdlet creates a reusable text "snippet" for Windows PowerShell ISE. You can use snippets to add text to the Script pane or Command pane in Windows PowerShell ISE. This cmdlet is available only in Windows PowerShell ISE. Beginning in Windows PowerShell 3.0, Windows PowerShell ISE includes a collection of built-in snippets. The **New-ISESnippet** cmdlet lets you create your own snippets to add to the built-in collection. You can view, change, add, delete, and share snippet files and include them in Windows PowerShell modules. -To see snippets in Windows PowerShell ISE, from the Edit menu, select Start Snippets or press CTRL+J. +To see snippets in Windows PowerShell ISE, from the **Edit** menu, select **Start Snippets** or press CTRL+J. The **New-ISESnippet** cmdlet creates a \.Snippets.ps1xml file in the $home\Documents\WindowsPowerShell\Snippets directory with the title that you specify. To include a snippet file in a module that you are authoring, add the snippet file to a Snippets subdirectory of your module directory. @@ -53,7 +54,7 @@ PS C:\> New-IseSnippet -Title Comment-BasedHelp -Description "A template for com ``` This command creates a Comment-BasedHelp snippet for Windows PowerShell ISE. -It creates a file named Comment-BasedHelp.snippets.ps1xml in the user's Snippets directory ($home\Documents\WindowsPowerShell\Snippets). +It creates a file named "Comment-BasedHelp.snippets.ps1xml" in the user's Snippets directory ($home\Documents\WindowsPowerShell\Snippets). ### Example 2: Create a mandatory snippet ``` @@ -72,7 +73,7 @@ PS C:\> New-ISESnippet -Text $M -Title Mandatory -Description "Adds a mandatory This example creates a Mandatory snippet for Windows PowerShell ISE. The first command saves the snippet text in the $M variable. The second command uses the **New-ISESnippet** cmdlet to create the snippet. -The command uses the *Force* parameter to overwrite a previous snippet with the same name. +The command uses the **Force** parameter to overwrite a previous snippet with the same name. ### Example 3: Copy a mandatory snippet from a folder to a destination folder ``` @@ -187,27 +188,31 @@ Accept wildcard characters: False ``` ### CommonParameters + This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### None + This cmdlet does not take input from the pipeline. ## OUTPUTS ### None + This cmdlet does not generate any output. ## NOTES -* **New-IseSnippet** stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot add them to a session in which the execution policy is **AllSigned** or **Restricted**. In a **Restricted** or **AllSigned** session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session. - If you use the **New-IseSnippet** cmdlet in a **Restricted** or **AllSigned** session, the snippet is created, but an error message appears when Windows PowerShell tries to add the newly created snippet to the session. +- **New-IseSnippet** stores new user-created snippets in unsigned .ps1xml files. As such, Windows PowerShell cannot add them to a session in which the execution policy is **AllSigned** or **Restricted**. In a **Restricted** or **AllSigned** session, you can create, get, and import unsigned user-created snippets, but you cannot use them in the session. + +If you use the **New-IseSnippet** cmdlet in a **Restricted** or **AllSigned** session, the snippet is created, but an error message appears when Windows PowerShell tries to add the newly created snippet to the session. To use the new snippet (and other unsigned user-created snippets), change the execution policy, and then restart Windows PowerShell ISE. - For more information about Windows PowerShell execution policies, see about_Execution_Policies. +For more information about Windows PowerShell execution policies, see about_Execution_Policies. -* - To change a snippet, edit the snippet file. You can edit snippet files in the Script pane of Windows PowerShell ISE. +- To change a snippet, edit the snippet file. You can edit snippet files in the Script pane of Windows PowerShell ISE. - To delete a snippet that you added, delete the snippet file. @@ -215,8 +220,6 @@ To use the new snippet (and other unsigned user-created snippets), change the ex - You can create a snippet that has the same name as a built-in snippet. Both snippets appear in the snippet menu in Windows PowerShell ISE. - - ## RELATED LINKS [Get-IseSnippet](Get-IseSnippet.md) diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index f0f5376a7978..be61b0b1b2a0 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -7,11 +7,11 @@ title: about_Automatic_Variables --- # About Automatic Variables -## SHORT DESCRIPTION +## Short description Describes variables that store state information for PowerShell. These variables are created and maintained by PowerShell. -## LONG DESCRIPTION +## Long description Conceptually, these variables are considered to be read-only. Even though they **can** be written to, for backward compatibility they **should not** be @@ -38,32 +38,31 @@ Same as `$PSItem`. Contains the current object in the pipeline object. You can use this variable in commands that perform an action on every object or on selected objects in a pipeline. -### $ARGS +### $args -Contains an array of the undeclared parameters and\/or parameter values -that are passed to a function, script, or script block. When you create a -function, you can declare the parameters by using the param keyword or by -adding a comma-separated list of parameters in parentheses after the -function name. +Contains an array of values for undeclared parameters that are passed to a +function, script, or script block. When you create a function, you can declare +the parameters by using the `param` keyword or by adding a comma-separated list +of parameters in parentheses after the function name. In an event action, the `$Args` variable contains objects that represent the event arguments of the event that is being processed. This variable is -populated only within the Action block of an event registration command. -The value of this variable can also be found in the SourceArgs property of +populated only within the `Action` block of an event registration command. +The value of this variable can also be found in the **SourceArgs** property of the **PSEventArgs** object that `Get-Event` returns. -### $CONSOLEFILENAME +### $ConsoleFileName -Contains the path of the console file (.psc1) that was most recently used +Contains the path of the console file (`.psc1`) that was most recently used in the session. This variable is populated when you start PowerShell with -the PSConsoleFile parameter or when you use the `Export-Console` cmdlet to +the **PSConsoleFile** parameter or when you use the `Export-Console` cmdlet to export snap-in names to a console file. When you use the `Export-Console` cmdlet without parameters, it automatically updates the console file that was most recently used in the session. You can use this automatic variable to determine which file will be updated. -### $ERROR +### $Error Contains an array of error objects that represent the most recent errors. The most recent error is the first error object in the array `$Error[0]`. @@ -72,44 +71,44 @@ To prevent an error from being added to the `$Error` array, use the **ErrorAction** common parameter with a value of **Ignore**. For more information, see [about_CommonParameters](about_CommonParameters.md). -### $EVENT +### $Event Contains a **PSEventArgs** object that represents the event that is being -processed. This variable is populated only within the Action block of an +processed. This variable is populated only within the `Action` block of an event registration command, such as `Register-ObjectEvent`. The value of this variable is the same object that the `Get-Event` cmdlet returns. Therefore, you can use the properties of the `Event` variable, such as -`$Event.TimeGenerated`, in an Action script block. +`$Event.TimeGenerated`, in an `Action` script block. -### $EVENTARGS +### $EventArgs Contains an object that represents the first event argument that derives -from EventArgs of the event that is being processed. This variable is -populated only within the Action block of an event registration command. -The value of this variable can also be found in the SourceEventArgs +from **EventArgs** of the event that is being processed. This variable is +populated only within the `Action` block of an event registration command. +The value of this variable can also be found in the **SourceEventArgs** property of the **PSEventArgs** object that `Get-Event` returns. -### $EVENTSUBSCRIBER +### $EventSubscriber Contains a **PSEventSubscriber** object that represents the event subscriber of the event that is being processed. This variable is populated only within -the Action block of an event registration command. The value of this +the `Action` block of an event registration command. The value of this variable is the same object that the `Get-EventSubscriber` cmdlet returns. -### $EXECUTIONCONTEXT +### $ExecutionContext Contains an **EngineIntrinsics** object that represents the execution context of the PowerShell host. You can use this variable to find the execution objects that are available to cmdlets. -### $FALSE +### $false -Contains FALSE. You can use this variable to represent FALSE in commands +Contains **FALSE**. You can use this variable to represent **FALSE** in commands and scripts instead of using the string "false". The string can be -interpreted as TRUE if it is converted to a non-empty string or to a +interpreted as **TRUE** if it is converted to a non-empty string or to a non-zero integer. -### $FOREACH +### $foreach Contains the enumerator (not the resulting values) of a [ForEach](about_ForEach.md) loop. The `$ForEach` variable exists only while @@ -125,7 +124,7 @@ Contains the full path of the user's home directory. This variable is the equivalent of the `"$env:homedrive$env:homepath"` Windows environment variables, typically `C:\Users\`. -### $HOST +### $Host Contains an object that represents the current host application for PowerShell. You can use this variable to represent the current host in @@ -133,36 +132,36 @@ commands or to display or change the properties of the host, such as `$Host.version` or `$Host.CurrentCulture`, or `$host.ui.rawui.setbackgroundcolor("Red")`. -### $INPUT +### $input Contains an enumerator that enumerates all input that is passed to a function. The `$input` variable is available only to functions and script blocks (which are unnamed functions). -- In a function without a Begin, Process, or End block, the `$input` variable enumerates the - collection of all input to the function. +- In a function without a `Begin`, `Process`, or `End` block, the `$input` + variable enumerates the collection of all input to the function. -- In the Process block of a function, the `$input` variable contains the object that is currently in - the pipeline. +- In the `Begin` block, the `$input` variable contains no data. -- In the End block, the `$input` variable enumerates the collection of all +- In the `Process` block, the `$input` variable contains the + object that is currently in the pipeline. + +- In the `End` block, the `$input` variable enumerates the collection of all input to the function. + > [!NOTE] > You cannot use the `$input` variable inside both the Process block and the > End block in the same function or script block. -> [!NOTE] -> The `$input` variable will contain no data inside of the Begin block. - Enumerators contain properties and methods you can use to retrieve loop values and change the current loop iteration. For more information, see [Using Enumerators](#using-enumerators). -### $LASTEXITCODE +### $LastExitCode Contains the exit code of the last Windows-based program that was run. -### $MATCHES +### $Matches The `Matches` variable works with the `-match` and `-notmatch` operators. When you submit scalar input to the `-match` or `-notmatch` operator, and @@ -175,15 +174,15 @@ For more information about the `-match` operator, see [about_comparison_operators](about_comparison_operators.md). For more information on regular expressions, see [about_Regular_Expressions](about_Regular_Expressions.md). -### $MYINVOCATION +### $MyInvocation Contains an information about the current command, such as the name, parameters, parameter values, and information about how the command was started, called, or "invoked," such as the name of the script that called the current command. -`$MyInvocation` is populated only for scripts, function, and script blocks. -You can use the information in the System.Management.Automation.InvocationInfo +`$MyInvocation` is populated only for scripts, function, and script blocks. You +can use the information in the **System.Management.Automation.InvocationInfo** object that `$MyInvocation` returns in the current script, such as the path and file name of the script (`$MyInvocation.MyCommand.Path`) or the name of a function (`$MyInvocation.MyCommand.Name`) to identify the current command. This @@ -194,10 +193,10 @@ properties. | Property | Description | | ------------- | --------------------------------------------------- | -| PSScriptRoot | Contains the full path to the script that invoked | +| **PSScriptRoot** | Contains the full path to the script that invoked | | | the current command. The value of this property is | | | populated only when the caller is a script. | -| PSCommandPath | Contains the full path and file name of the script | +| **PSCommandPath** | Contains the full path and file name of the script | | | that invoked the current command. The value of this | | | property is populated only when the caller is a | | | script. | @@ -207,7 +206,7 @@ Unlike the `$PSScriptRoot` and `$PSCommandPath` automatic variables, the automatic variable contain information about the invoker or calling script, not the current script. -### $NESTEDPROMPTLEVEL +### $NestedPromptLevel Contains the current prompt level. A value of 0 indicates the original prompt level. The value is incremented when you enter a nested level and @@ -229,8 +228,8 @@ that it is always visible. ### $NULL -`$null` is an automatic variable that contains a NULL or empty value. You can -use this variable to represent an absent or undefined value in commands and +`$null` is an automatic variable that contains a **NULL** or empty value. You +can use this variable to represent an absent or undefined value in commands and scripts. PowerShell treats `$null` as an object with a value, that is, as an explicit @@ -270,7 +269,7 @@ can use it in scripts like the following one, which would not work if `$null` were ignored. ```powershell -$calendar = @($null, $null, “Meeting”, $null, $null, “Team Lunch”, $null) +$calendar = @($null, $null, "Meeting", $null, $null, "Team Lunch", $null) $days = "Sunday","Monday","Tuesday","Wednesday","Thursday", "Friday","Saturday" $currentDay = 0 @@ -314,11 +313,11 @@ New-Item -ItemType file -Path $PSHOME -Force You can also use it in a command to open the profile in Notepad: -``` +```powershell notepad $profile ``` -### $PSBOUNDPARAMETERS +### $PSBoundParameterValues Contains a dictionary of the parameters that are passed to a script or function and their current values. This variable has a value only in a @@ -340,7 +339,7 @@ function Test { } ``` -### $PSCMDLET +### $PSCmdlet Contains an object that represents the cmdlet or advanced function that is being run. @@ -354,12 +353,12 @@ being used, and the **ShouldProcess** method adds the **WhatIf** and For more information about the `$PSCmdlet` automatic variable, see [about_Functions_Advanced](about_Functions_Advanced.md). -### $PSCOMMANDPATH +### $PSCommandPath Contains the full path and file name of the script that is being run. This variable is valid in all scripts. -### $PSCULTURE +### $PSCulture Contains the name of the culture currently in use in the operating system. The culture determines the display format of items such as numbers, @@ -368,7 +367,7 @@ currency, and dates. This is the value of the system. To get the **System.Globalization.CultureInfo** object for the system, use the `Get-Culture` cmdlet. -### $PSDEBUGCONTEXT +### $PSDebugContext While debugging, this variable contains information about the debugging environment. Otherwise, it contains a NULL value. As a result, you can use it diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_CommonParameters.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_CommonParameters.md index 3810c29a8484..8e988619503e 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_CommonParameters.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_CommonParameters.md @@ -5,7 +5,6 @@ locale: en-us keywords: powershell,cmdlet title: about_CommonParameters --- - # About CommonParameters ## SHORT DESCRIPTION @@ -37,22 +36,22 @@ to user data usually offer these parameters. The following list displays the common parameters. Their aliases are listed in parentheses. -* Debug (db) -* ErrorAction (ea) -* ErrorVariable (ev) -* InformationAction (infa) -* InformationVariable (iv) -* OutVariable (ov) -* OutBuffer (ob) -* PipelineVariable (pv) -* Verbose (vb) -* WarningAction (wa) -* WarningVariable (wv) +- Debug (db) +- ErrorAction (ea) +- ErrorVariable (ev) +- InformationAction (infa) +- InformationVariable (iv) +- OutVariable (ov) +- OutBuffer (ob) +- PipelineVariable (pv) +- Verbose (vb) +- WarningAction (wa) +- WarningVariable (wv) The risk mitigation parameters are: -* WhatIf (wi) -* Confirm (cf) +- WhatIf (wi) +- Confirm (cf) For more information about preference variables, type: help about_Preference_Variables @@ -127,7 +126,7 @@ Stores error messages about the command in the specified variable and in the $Error automatic variable. For more information, type the following command: ```powershell -get-help about_Automatic_Variables +Get-Help about_Automatic_Variables ``` By default, new error messages overwrite error messages that are already @@ -140,6 +139,7 @@ errors in it: ```powershell Get-Process -Id 6 -ErrorVariable a ``` + The following command adds any error messages to the $a variable: ```powershell @@ -188,7 +188,7 @@ Valid values: - Suspend: Automatically suspends a workflow job after a Write-Information command is carried out, to allow users to see the messages before - continuing. The workflow can be resumed at the user’s discretion. + continuing. The workflow can be resumed at the user's discretion. - SilentlyContinue: No effect. The informational messages are not (Default) displayed, and the script continues without interruption. @@ -275,9 +275,9 @@ that the results should be displayed as "Left range member * Right range member = product". ```powershell -1..10 | Foreach-Object -PipelineVariable Left -Process { $_ } | - Foreach-Object -PV Right -Process { 1..10 } | - Foreach-Object -Process { "$Left * $Right = " + ($Left*$Right) } +1..10 | ForEach-Object -PipelineVariable Left -Process { $_ } | + ForEach-Object -PipelineVariable Right -Process { 1..10 } | + ForEach-Object -Process { "$Left * $Right = " + ($Left*$Right) } ``` ```output diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_PSSnapins.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_PSSnapins.md index a8ed68b62c50..d3368d3bf840 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_PSSnapins.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_PSSnapins.md @@ -8,7 +8,8 @@ title: about_PSSnapins # About PSSnapins ## SHORT DESCRIPTION -Describes Windows PowerShell® snap-ins and shows how to use and manage them. + +Describes Windows PowerShell snap-ins and shows how to use and manage them. ## LONG DESCRIPTION @@ -39,19 +40,19 @@ in the MSDN library. To get a list of the Windows PowerShell snap-ins on your computer, type: ```powershell -get-pssnapin +Get-PSSnapin ``` To get the snap-in for each Windows PowerShell provider, type: ```powershell -get-psprovider | format-list name, pssnapin +Get-PSProvider | Format-List name, pssnapin ``` To get a list of the cmdlets in a Windows PowerShell snap-in, type: ```powershell -get-command -module +Get-Command -Module ``` ### INSTALLING A SNAP-IN @@ -77,7 +78,7 @@ To get all the registered snap-ins on your system or to verify that a snap-in is registered, type: ```powershell -get-pssnapin -registered +Get-PSSnapin -registered ``` ### ADDING THE SNAP-IN TO THE CURRENT SESSION @@ -87,7 +88,7 @@ cmdlet. For example, to add the Microsoft SQL Server snap-in to the session, type: ```powershell -add-pssnapin sql +Add-PSSnapin sql ``` After the command is completed, the providers and cmdlets in the snap-in are @@ -114,7 +115,7 @@ session configuration to the NewConsole.psc1 file in the current directory, type: ```powershell -export-console NewConsole +Export-Console NewConsole ``` For more information, see Export-Console. @@ -140,7 +141,7 @@ Remove-PsSnapin cmdlet. For example, to remove the SQL Server snap-in from the current session, type: ```powershell -remove-pssnapin sql +Remove-PSSnapin sql ``` This cmdlet removes the snap-in from the session. The snap-in is still loaded, diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_Preference_Variables.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_Preference_Variables.md index 47ae459c73a3..500c871d512a 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_Preference_Variables.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_Preference_Variables.md @@ -8,6 +8,7 @@ title: about_Preference_Variables # About Preference Variables ## SHORT DESCRIPTION + Variables that customize the behavior of PowerShell ## LONG DESCRIPTION @@ -283,15 +284,15 @@ single command. ```powershell PS> $debugpreference = "Stop" #Change the value to "Stop" -PS> write-debug "Hello, World" +PS> Write-Debug "Hello, World" DEBUG: Hello, World Write-Debug : Command execution stopped because the shell variable "Debug Preference" is set to Stop. At line:1 char:12 -+ write-debug <<<< "Hello, World" ++ Write-Debug <<<< "Hello, World" PS> # Use the Debug parameter with $false -PS> write-debug "Hello, World" -Debug:$false +PS> Write-Debug "Hello, World" -Debug:$false PS> # The debug message is not displayed and processing is not stopped. ``` @@ -377,14 +378,14 @@ PS> # Change the value of the preference. PS> $ErrorActionPreference = "SilentlyContinue" PS> # Generate an error message. -PS> write-error "Hello, World" +PS> Write-Error "Hello, World" PS> # Error message is suppressed. PS> # Use the ErrorAction parameter with a value of "Continue". -PS> write-error "Hello, World" -erroraction:continue +PS> Write-Error "Hello, World" -erroraction:continue PS> # The error message is displayed and execution continues. -write-error "Hello, World" -erroraction:continue : Hello, World +Write-Error "Hello, World" -erroraction:continue : Hello, World ``` This example shows the effect of a real error. In this case, the command gets @@ -395,24 +396,24 @@ parameter to override the preference. PS> $erroractionpreference SilentlyContinue # Display the value of the preference. -PS> get-childitem -path nofile.txt +PS> Get-ChildItem -path nofile.txt PS> # Error message is suppressed. PS> # Change the value to Continue. PS> $ErrorActionPreference = "Continue" -PS> get-childitem -path nofile.txt +PS> Get-ChildItem -path nofile.txt Get-ChildItem : Cannot find path 'C:\nofile.txt' because it does not exist. At line:1 char:4 -+ get-childitem <<<< nofile.txt ++ Get-ChildItem <<<< nofile.txt PS> # Use the ErrorAction parameter -PS> get-childitem -path nofile.txt -erroraction SilentlyContinue +PS> Get-ChildItem -path nofile.txt -erroraction SilentlyContinue PS> # Error message is suppressed. PS> # Change the value to Inquire. PS> $ErrorActionPreference = "Inquire" -PS> get-childitem -path nofile.txt +PS> Get-ChildItem -path nofile.txt Confirm Cannot find path 'C:\nofile.txt' because it does not exist. @@ -421,7 +422,7 @@ Cannot find path 'C:\nofile.txt' because it does not exist. Get-ChildItem : Cannot find path 'C:\nofile.txt' because it does not exist. At line:1 char:4 -+ get-childitem <<<< nofile.txt ++ Get-ChildItem <<<< nofile.txt PS> # Change the value to Continue. PS> $ErrorActionPreference = "Continue" @@ -464,10 +465,10 @@ non-existent file. PS> $ErrorView # Verify the value. NormalView -PS> get-childitem nofile.txt # Find a non-existent file. +PS> Get-ChildItem nofile.txt # Find a non-existent file. Get-ChildItem : Cannot find path 'C:\nofile.txt' because it does not exist. At line:1 char:14 -+ get-childitem <<<< nofile.txt ++ Get-ChildItem <<<< nofile.txt ``` This example shows how the same error appears when the value of @@ -492,7 +493,7 @@ error in the error array (element 0) and formats all of the properties of the error object in a list. ```powershell -PS> $error[0] | format-list -property * -force +PS> $error[0] | Format-List -Property * -force Exception : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\nofile.txt' because it does not exist. @@ -550,7 +551,7 @@ PS> $formatenumerationlimit # Find the current value 4 PS> # List all services grouped by status -PS> get-service | group-object -property status +PS> get-service | Group-Object -Property status Count Name Group ----- ---- ----- @@ -560,7 +561,7 @@ PS> # The list is truncated after 4 items. PS> # Increase the limit to 1000. PS> $formatenumerationlimit = 1000 -PS> get-service | group-object -property status +PS> get-service | Group-Object -Property status Count Name Group ----- ---- ----- @@ -568,7 +569,7 @@ Count Name Group 41 Stopped {Alerter, AppMgmt, aspnet_state, ATI Smart, Browser, CiSvc... PS> # Add the Wrap parameter. -PS> get-service | group-object -property status | format-table -wrap +PS> get-service | Group-Object -Property status | Format-Table -wrap Count Name Group ----- ---- ----- @@ -612,7 +613,7 @@ Valid values: - Continue: Displays the informational message, and continues running. - Suspend: Automatically suspends a workflow job after a Write-Information command is carried out, to allow users to see the messages before - continuing. The workflow can be resumed at the user’s discretion. + continuing. The workflow can be resumed at the user's discretion. - SilentlyContinue: No effect. The informational messages are not (Default) displayed, and the script continues without interruption. @@ -682,7 +683,7 @@ Default: 4096 To count the aliases on your system, type: ```powershell -(get-alias).count +(Get-Alias).count ``` #### \$MaximumDriveCount @@ -698,7 +699,7 @@ Default: 4096 To count the aliases on your system, type: ```powershell -(get-psdrive).count +(Get-PSDrive).count ``` #### \$MaximumErrorCount @@ -737,7 +738,7 @@ $Error[($Error.Count -1] To display the properties of the ErrorRecord object, type: ```powershell -$Error[0] | format-list -property * -force +$Error[0] | Format-List -Property * -force ``` In this command, the Force parameter overrides the special formatting of @@ -776,13 +777,13 @@ the Function provider, type "get-help function"). To list the functions in the current session, type: ```powershell -get-childitem function: +Get-ChildItem function: ``` To count the functions in the current session, type: ```powershell -(get-childitem function:).count +(Get-ChildItem function:).count ``` #### \$MaximumHistoryCount @@ -798,7 +799,7 @@ To determine the number of commands current saved in the command history, type: ```powershell -(get-history).count +(Get-History).count ``` To see the command saved in your session history, use the Get-History @@ -822,7 +823,7 @@ variable". To find the current number of variables on the system, type: ```powershell -(get-variable).count +(Get-Variable).count ``` #### \$OFS @@ -960,6 +961,7 @@ PS> # Set the value equal to the OutputEncoding property of the console. PS> $OutputEncoding.EncodingName OEM United States ``` + As a result of this change, the FINDSTR command finds the characters. ```powershell @@ -1305,12 +1307,12 @@ PS> Write-Warning "This action can delete data." PS> # Write a warning message. PS> # Use the WarningAction to stop when a warning is generated. -PS> Write-Warning "This step can delete data." -warningaction stop +PS> Write-Warning "This step can delete data." -WarningAction stop WARNING: This action can delete data. Write-Warning : Command execution stopped because the shell variable "WarningPreference" is set to Stop. At line:1 char:14 -+ Write-Warning <<<< "This action can delete data." -warningaction stop ++ Write-Warning <<<< "This action can delete data." -WarningAction stop ``` This example shows the effect of the Inquire value. @@ -1401,18 +1403,18 @@ PS> $whatifpreference 0 # Check the current value. PS> # Verify that the file exists. -PS> get-childitem test.txt | format-list FullName +PS> Get-ChildItem test.txt | Format-List FullName FullName : C:\test.txt PS> remove-item test.txt PS> # Delete the file. PS> # Verify that the file is deleted. -PS> get-childitem test.txt | format-list -property FullName +PS> Get-ChildItem test.txt | Format-List -Property FullName Get-ChildItem : Cannot find path 'C:\test.txt' because it does not exist. At line:1 char:14 -+ get-childitem <<<< test.txt | format-list fullname ++ Get-ChildItem <<<< test.txt | Format-List fullname ``` This example shows the effect of using the WhatIf parameter when the value @@ -1420,7 +1422,7 @@ of \$WhatIfPreference is 0. ```powershell PS> # Verify that the file exists. -PS> get-childitem test2.txt | format-list -property FullName +PS> get-childitem test2.txt | Format-List -Property FullName FullName : C:\test2.txt PS> # Use the WhatIf parameter @@ -1428,7 +1430,7 @@ PS> remove-item test2.txt -whatif What if: Performing operation "Remove File" on Target "C:\test2.txt". PS> # Verify that the file was not deleted -PS> get-childitem test2.txt | format-list -property FullName +PS> get-childitem test2.txt | Format-List -Property FullName FullName : C:\test2.txt ``` @@ -1446,7 +1448,7 @@ PS> remove-item test.txt What if: Performing operation "Remove File" on Target "C:\test.txt". PS> # Verify that the file exists. -PS> get-childitem test.txt | format-list FullName +PS> get-childitem test.txt | Format-List FullName FullName : C:\test.txt ``` @@ -1469,7 +1471,7 @@ a value of \$false. PS> # Change the value to 1. PS> $whatifpreference = 1 -PS> get-process winword +PS> Get-Process winword A Get-Process command completes. Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName @@ -1484,11 +1486,11 @@ PS> stop-process -name winword -whatif:$false PS> # WhatIf:$false overrides the preference. PS> # Verify that the process is stopped. -PS> get-process winword +PS> Get-Process winword Get-Process : Cannot find a process with the name 'winword'. Verify the process name and call the cmdlet again. At line:1 char:12 -+ get-process <<<< winword ++ Get-Process <<<< winword ``` ## SEE ALSO diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_Properties.md index 150de517ae6b..f3ed0fec6601 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_Properties.md @@ -149,7 +149,7 @@ VersionInfo : File: C:\Windows\System32\WindowsPowerShell\ OriginalFilename: PowerShell.EXE.MUI FileVersion: 10.0.16299.15 (WinBuild.160101.0800) FileDescription: Windows PowerShell - Product: Microsoft® Windows® Operating System + Product: Microsoft Windows Operating System ProductVersion: 10.0.16299.15 Debug: False Patched: False diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md index d1cd5d0c224d..cb46d7b3ae9b 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_Remote_Troubleshooting.md @@ -5,9 +5,11 @@ locale: en-us keywords: powershell,cmdlet title: about_Remote_Troubleshooting --- + # About Remote Troubleshooting ## SHORT DESCRIPTION + Describes how to troubleshoot remote operations in PowerShell. ## LONG DESCRIPTION @@ -822,7 +824,7 @@ the command again. 1. Start PowerShell with the "Run as administrator" option. 2. Run the following command: -   `Start-Service WinRM` + `Start-Service WinRM` 3. Re-run the command that generated the error. diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_Splatting.md index 9b005fb58155..a0fb3ac1fde0 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -5,9 +5,11 @@ locale: en-us keywords: powershell,cmdlet title: about_Splatting --- + # About Splatting ## SHORT DESCRIPTION + Describes how to use splatting to pass parameters to commands in Windows PowerShell. @@ -52,7 +54,7 @@ single command just so you pass no more than one value for each parameter. ## SPLATTING WITH HASH TABLES Use a hash table to splat parameter name and value pairs. You can use this -format for all parameter types, including positional and switch parameters. +format for all parameter types, including positional and switch parameters. Positional parameters must be assigned by name. The following examples compare two `Copy-Item` commands that copy the Test.txt @@ -84,7 +86,7 @@ Copy-Item @HashArguments Note: In the first command, the At symbol (@) indicates a hash table, not a splatted value. The syntax for hash tables in PowerShell is: -@{\=\; \=\; …}* +`@{\=\; \=\; ...}*` ## SPLATTING WITH ARRAYS @@ -269,7 +271,7 @@ FileVersionInfo : File: C:\Windows\System32\WindowsPowerShell OriginalFilename: PowerShell.EXE.MUI FileVersion: 10.0.14393.0 (rs1_release.160715-1616 FileDescription: Windows PowerShell - Product: Microsoft® Windows® Operating System + Product: Microsoft Windows Operating System ProductVersion: 10.0.14393.0 Debug: False Patched: False diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_WMI.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_WMI.md index fe12ac209728..9471be55aa4b 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_WMI.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_WMI.md @@ -5,20 +5,22 @@ locale: en-us keywords: powershell,cmdlet title: about_WMI --- + # About WMI ## SHORT DESCRIPTION + Windows Management Instrumentation (WMI) uses the Common Information Model (CIM) to represent systems, applications, networks, devices, and other manageable components of the modern enterprise. ## LONG DESCRIPTION -Windows Management Instrumentation (WMI) is Microsoft’s implementation of +Windows Management Instrumentation (WMI) is Microsoft's implementation of Web-Based Enterprise Management (WBEM), the industry standard. Classic WMI uses DCOM to communicate with networked devices to manage remote -systems. Windows PowerShell® 3.0 introduces a CIM provider model that uses +systems. Windows PowerShell 3.0 introduces a CIM provider model that uses WinRM to remove the dependency on DCOM. This CIM provider model also uses new WMI provider APIs that enable developers to write Windows PowerShell cmdlets in native code (C\+\+). diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_Windows_RT.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_Windows_RT.md index 61b03d5d0bd0..cf046396aa0d 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_Windows_RT.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_Windows_RT.md @@ -5,10 +5,12 @@ locale: en-us keywords: powershell,cmdlet title: about_Windows_RT --- + # About Windows RT ## SHORT DESCRIPTION -Explains limitations of Windows PowerShell® 4.0 on Windows RT 8.1. + +Explains limitations of Windows PowerShell 4.0 on Windows RT 8.1. ## LONG DESCRIPTION @@ -35,9 +37,9 @@ devices. The following list explains the differences. While remoting is disabled, you can use Windows PowerShell remoting to run commands on other computers, but other computers cannot run commands on the - Windows RT device. Also, implicit remoting—that is, remoting that is built in - to a cmdlet or script, and not explicitly requested with added parameters—does - not work in Windows PowerShell running on Windows RT 8.1. + Windows RT device. Also, implicit remoting - that is, remoting that is built + in to a cmdlet or script, and not explicitly requested with added parameters + - does not work in Windows PowerShell running on Windows RT 8.1. - Domain-joined computing and Kerberos authentication are not supported on Windows RT 8.1. You cannot use Windows PowerShell to add or manage these diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md index 8dddad3b5af5..4a765ea7f41c 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_desiredstateconfiguration.md @@ -71,8 +71,8 @@ Node $MachineName # "WebDirectory" is the name you want to use to refer to this instance File WebDirectory { - Ensure = "Present" # You can also set Ensure to "Absent“ - Type = "Directory“ # Default is “File” + Ensure = "Present" # You can also set Ensure to "Absent" + Type = "Directory" # Default is "File" Recurse = $true SourcePath = $WebsiteFilePath DestinationPath = "C:\inetpub\wwwroot" @@ -90,7 +90,7 @@ would invoke a PowerShell function, passing in any expected parameters you may have defined (two in the example above). For example, in this case: ```powershell -MyWebConfig -MachineName "TestMachine" –WebsiteFilePath ` +MyWebConfig -MachineName "TestMachine" -WebsiteFilePath ` "\\filesrv\WebFiles" -OutputPath "C:\Windows\system32\temp" # OutputPath is optional ``` @@ -102,7 +102,7 @@ configuration, and enact those configurations. Note that you do not need to create a separate MOF file for class-based DSC resources. ```powershell -Start-DscConfiguration –Verbose -Wait -Path "C:\Windows\system32\temp" +Start-DscConfiguration -Verbose -Wait -Path "C:\Windows\system32\temp" ``` ## USING DSC TO MAINTAIN CONFIGURATION STATE diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_hidden.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_hidden.md index cc8b4349c60b..94ceb610e7b9 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_hidden.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_hidden.md @@ -105,7 +105,7 @@ ModelYear Property string ModelYear {get;set;} ``` -Now, try running Get-Member again, but this time, add the –Force parameter. +Now, try running Get-Member again, but this time, add the -Force parameter. Note that the results contain the hidden rides property, among other members that are hidden by default. @@ -116,7 +116,7 @@ PS C:\Windows\system32> $TestCar | Get-Member -Force Name MemberType Definition ---- ---------- ---------- -pstypenames CodeProperty System.Collections.ObjectModel.Collection`1… +pstypenames CodeProperty System.Collections.ObjectModel.Collection`1 psadapted MemberSet psadapted {Color, ModelYear, Distance, psbase MemberSet psbase {Color, ModelYear, Distance,... psextended MemberSet psextended {} diff --git a/reference/5.0/Microsoft.PowerShell.Core/About/about_windows_powershell_5.0.md b/reference/5.0/Microsoft.PowerShell.Core/About/about_windows_powershell_5.0.md index 5c4a19090ddb..27c7aa08b85a 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/About/about_windows_powershell_5.0.md +++ b/reference/5.0/Microsoft.PowerShell.Core/About/about_windows_powershell_5.0.md @@ -90,9 +90,9 @@ You can also read about changes to Windows PowerShell 5.0 in - New cmdlets in the Microsoft.PowerShell.Utility module, Get-Runspace, Debug-Runspace, Get-RunspaceDebug, Enable-RunspaceDebug, and Disable-RunspaceDebug, let you set debug options on a runspace, and start - and stop debugging on a runspace. For debugging arbitrary runspaces—that is, + and stop debugging on a runspace. For debugging arbitrary runspaces - that is, runspaces that are not the default runspace for a Windows PowerShell console - or Windows PowerShell ISE session—Windows PowerShell lets you set + or Windows PowerShell ISE session - Windows PowerShell lets you set breakpoints in a script, and have added breakpoints stop the script from running until you can attach a debugger to debug the runspace script. Nested debugging support for arbitrary runspaces has been added to the Windows @@ -175,7 +175,7 @@ You can also read about changes to Windows PowerShell 5.0 in - Windows PowerShell language enhancements let you define Windows PowerShell Desired State Configuration (DSC) resources by using classes. Import-DscResource is now a true dynamic keyword; Windows PowerShell parses - the specified module’s root module, searching for classes that contain the + the specified module's root module, searching for classes that contain the DscResource attribute. You can now use classes to define DSC resources, in which neither a MOF file nor a DSCResource subfolder in the module folder is required. A Windows PowerShell module file can contain multiple DSC resource @@ -225,7 +225,7 @@ You can also read about changes to Windows PowerShell 5.0 in - Partial configurations are now allowed in Windows PowerShell 5.0. You can deliver configuration documents to a node in fragments. For a node to - receive multiple fragments of a configuration document, the node’s Local + receive multiple fragments of a configuration document, the node's Local Configuration Manager must be first set to specify the expected fragments. - Cross-computer synchronization is new in DSC in Windows PowerShell 5.0. By @@ -233,7 +233,7 @@ You can also read about changes to Windows PowerShell 5.0 in WaitForSome), you can now specify dependencies across computers during configuration runs, without external orchestrations. These resources provide node-to-node synchronization by using CIM connections over the WS-Man - protocol. A configuration can wait for another computer’s specific resource + protocol. A configuration can wait for another computer's specific resource state to change. - Just Enough Administration (JEA), a new delegation security feature, @@ -265,7 +265,7 @@ You can also read about changes to Windows PowerShell 5.0 in - You can now edit remote Windows PowerShell scripts and files in a local copy of Windows PowerShell ISE, by running Enter-PSSession to start a remote - session on the computer that’s storing the files you want to edit, and then + session on the computer that's storing the files you want to edit, and then running PSEdit . This feature eases editing Windows PowerShell files that are stored on the Server Core installation option of Windows Server, where Windows PowerShell ISE cannot diff --git a/reference/5.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md b/reference/5.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md index 505c8d55f92c..e5ffcfbf3010 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md +++ b/reference/5.0/Microsoft.PowerShell.Core/Enable-PSRemoting.md @@ -7,10 +7,10 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821475 external help file: System.Management.Automation.dll-Help.xml title: Enable-PSRemoting --- - # Enable-PSRemoting ## SYNOPSIS + Configures the computer to receive remote commands. ## SYNTAX @@ -20,69 +20,76 @@ Enable-PSRemoting [-Force] [-SkipNetworkProfileCheck] [-WhatIf] [-Confirm] [ [!CAUTION] +> On systems that have both Windows PowerShell 3.0 and the Windows PowerShell 2.0 engine, do not use +> Windows PowerShell 2.0 to run the **Enable-PSRemoting** and Disable-PSRemoting cmdlets. The commands +> might appear to succeed, but the remoting is not configured correctly. Remote commands, and later +> attempts to enable and disable remoting, are likely to fail. ## EXAMPLES ### Example 1: Configure a computer to receive remote commands -``` -PS C:\> Enable-PSRemoting + +```powershell +Enable-PSRemoting ``` This command configures the computer to receive remote commands. ### Example 2: Configure a computer to receive remote commands without a confirmation prompt -``` -PS C:\> Enable-PSRemoting -Force + +```powershell +Enable-PSRemoting -Force ``` This command configures the computer to receive remote commands. It uses the *Force* parameter to suppress the user prompts. ### Example 3: Allow remote access on clients -``` -PS C:\> Enable-PSRemoting -SkipNetworkProfileCheck -Force -PS C:\> Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any + +```powershell +Enable-PSRemoting -SkipNetworkProfileCheck -Force + +Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any ``` -This example shows how to allow remote access from public networks on client versions of the Windows operating system. +This example shows how to allow remote access from public networks on client versions of Windows. Before using these commands, analyze the security setting and verify that the computer network will be safe from harm. The first command enables remoting in Windows PowerShell. By default, this creates network rules that allow remote access from private and domain networks. -The command uses the *SkipNetworkProfileCheck* parameter to allow remote access from public networks in the same local subnet. -The command specifies the *Force* parameter to suppress confirmation messages. +The command uses the **SkipNetworkProfileCheck** parameter to allow remote access from public networks in the same local subnet. +The command uses the Force parameter to suppress confirmation messages. -The *SkipNetworkProfileCheck* parameter does not affect server version of the Windows operating system, which allow remote access from public networks in the same local subnet by default. +The **SkipNetworkProfileCheck** parameter has no effect on server version of Windows, which allow remote access from public networks in the same local subnet by default. The second command eliminates the subnet restriction. The command uses the **Set-NetFirewallRule** cmdlet in the **NetSecurity** module to add a firewall rule that allows remote access from public networks from any remote location. @@ -91,6 +98,7 @@ This includes locations in different subnets. ## PARAMETERS ### -Confirm + Prompts you for confirmation before running the cmdlet. ```yaml @@ -106,7 +114,9 @@ Accept wildcard characters: False ``` ### -Force -Forces the command to run without asking for user confirmation. + +Suppresses all user prompts. +By default, you are prompted to confirm each operation. ```yaml Type: SwitchParameter @@ -115,17 +125,18 @@ Aliases: Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### -SkipNetworkProfileCheck -Indicates that this cmdlet enables remoting on client versions of the Windows operating system when the computer is on a public network. + +Enables remoting on client versions of Windows when the computer is on a public network. This parameter enables a firewall rule for public networks that allows remote access only from computers in the same local subnet. -This parameter does not affect server versions of the Windows operating system, which, by default, have a local subnet firewall rule for public networks. -If the local subnet firewall rule is disabled on a server version, **Enable-PSRemoting** re-enables it, regardless of the value of this parameter. +This parameter has no effect on server versions of Windows, which, by default, have a local subnet firewall rule for public networks. +If the local subnet firewall rule is disabled on a server version of Windows, **Enable-PSRemoting** re-enables it, regardless of the value of this parameter. To remove the local subnet restriction and enable remote access from all locations on public networks, use the **Set-NetFirewallRule** cmdlet in the **NetSecurity** module. @@ -138,12 +149,13 @@ Aliases: Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### -WhatIf + Shows what would happen if the cmdlet runs. The cmdlet is not run. @@ -160,38 +172,42 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +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 ### None + You cannot pipe input to this cmdlet. ## OUTPUTS ### System.String + This cmdlet returns strings that describe its results. ## NOTES -* In Windows PowerShell 3.0, **Enable-PSRemoting** creates the following firewall exceptions for WS-Management communications. - On server versions of the Windows operating system, **Enable-PSRemoting** creates firewall rules for private and domain networks that allow remote access, and creates a firewall rule for public networks that allows remote access only from computers in the same local subnet. +- In Windows PowerShell 3.0, **Enable-PSRemoting** creates the following firewall exceptions for WS-Management communications. + + On server versions of Windows, **Enable-PSRemoting** creates firewall rules for private and domain networks that allow remote access, and creates a firewall rule for public networks that allows remote access only from computers in the same local subnet. - On client versions of the Windows operating system, **Enable-PSRemoting** in Windows PowerShell 3.0 creates firewall rules for private and domain networks that allow unrestricted remote access. -To create a firewall rule for public networks that allows remote access from the same local subnet, use the *SkipNetworkProfileCheck* parameter. + On client versions of Windows, **Enable-PSRemoting** in Windows PowerShell 3.0 creates firewall rules for private and domain networks that allow unrestricted remote access. + To create a firewall rule for public networks that allows remote access from the same local subnet, use the **SkipNetworkProfileCheck** parameter. - On client or server versions of the Windows operating system, to create a firewall rule for public networks that removes the local subnet restriction and allows remote access , use the **Set-NetFirewallRule** cmdlet in the NetSecurity module to run the following command: `Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any` + On client or server versions of Windows, to create a firewall rule for public networks that removes the local subnet restriction and allows remote access , use the **Set-NetFirewallRule** cmdlet in the NetSecurity module to run the following command: `Set-NetFirewallRule -Name "WINRM-HTTP-In-TCP-PUBLIC" -RemoteAddress Any` -* In Windows PowerShell 2.0, **Enable-PSRemoting** creates the following firewall exceptions for WS-Management communications. +- In Windows PowerShell 2.0, **Enable-PSRemoting** creates the following firewall exceptions for WS-Management communications. - On server versions of the Windows operating system, it creates firewall rules for all networks that allow remote access. + On server versions of Windows, it creates firewall rules for all networks that allow remote access. - On client versions of the Windows operating system, **Enable-PSRemoting** in Windows PowerShell 2.0 creates a firewall exception only for domain and private network locations. -To minimize security risks, **Enable-PSRemoting** does not create a firewall rule for public networks on client versions of Windows. -When the current network location is public, **Enable-PSRemoting** returns the following message: Unable to check the status of the firewall. + On client versions of Windows, Enable-PSRemoting in Windows PowerShell 2.0 creates a firewall exception only for domain and private network locations. + To minimize security risks, **Enable-PSRemoting** does not create a firewall rule for public networks on client versions of Windows. + When the current network location is public, **Enable-PSRemoting** returns the following message: "Unable to check the status of the firewall." -* Starting in Windows PowerShell 3.0, **Enable-PSRemoting** enables all session configurations by setting the value of the **Enabled** property of all session configurations (WSMan:\\\\Plugin\\\\Enabled) to True ($True). -* In Windows PowerShell 2.0, **Enable-PSRemoting** removes the Deny_All setting from the security descriptor of session configurations. In Windows PowerShell 3.0, **Enable-PSRemoting** removes the Deny_All and Network_Deny_All settings. This provides remote access to session configurations that were reserved for local use. +- Beginning in Windows PowerShell 3.0, **Enable-PSRemoting** enables all session configurations by setting the value of the **Enabled** property of all session configurations (WSMan:\\\\Plugin\\\\Enabled) to True ($true). +- In Windows PowerShell 2.0, **Enable-PSRemoting** removes the Deny_All setting from the security descriptor of session configurations. In Windows PowerShell 3.0, **Enable-PSRemoting** removes the Deny_All and Network_Deny_All settings, thereby providing remote access to session configurations that were reserved for local use. ## RELATED LINKS @@ -207,7 +223,7 @@ When the current network location is public, **Enable-PSRemoting** returns the f [Disable-PSRemoting](Disable-PSRemoting.md) -[WSMan Provider](../Microsoft.WsMan.Management/Providers/WSMan-Provider.md) +[WSMan Provider](../Microsoft.WsMan.Management/About/about_WSMan_Provider.md) [about_Remote](About/about_Remote.md) diff --git a/reference/5.0/Microsoft.PowerShell.Core/Get-Module.md b/reference/5.0/Microsoft.PowerShell.Core/Get-Module.md index f86a32462637..e135e4ab2826 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/Get-Module.md +++ b/reference/5.0/Microsoft.PowerShell.Core/Get-Module.md @@ -7,7 +7,6 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821486 external help file: System.Management.Automation.dll-Help.xml title: Get-Module --- - # Get-Module ## SYNOPSIS @@ -29,18 +28,18 @@ Get-Module [[-Name] ] [-FullyQualifiedName ] [- -CimSession [-CimResourceUri ] [-CimNamespace ] [] ``` -### Available +### PsSession ```powershell -Get-Module [[-Name] ] [-FullyQualifiedName ] [-All] [-ListAvailable] - [-Refresh] [] +Get-Module [[-Name] ] [-FullyQualifiedName ] [-ListAvailable] [-Refresh] + -PSSession [] ``` -### PsSession +### Available ```powershell -Get-Module [[-Name] ] [-FullyQualifiedName ] [-ListAvailable] [-Refresh] - -PSSession [] +Get-Module [[-Name] ] [-FullyQualifiedName ] [-All] [-ListAvailable] + [-Refresh] [] ``` ## DESCRIPTION @@ -50,33 +49,30 @@ The module object that `Get-Module` returns contains valuable information about You can also pipe the module objects to other cmdlets, such as the `Import-Module` and `Remove-Module` cmdlets. Without parameters, `Get-Module` gets modules that have been imported into the current session. -To get all installed modules, specify the **ListAvailable** parameter. +To get all installed modules, use the **ListAvailable** parameter. `Get-Module` gets modules, but it does not import them. -Starting in Windows PowerShell 3.0, modules are automatically imported when you use a command in the module, but a `Get-Module` command does not trigger an automatic import. +Beginning in Windows PowerShell 3.0, modules are automatically imported when you use a command in the module, but a `Get-Module` command does not trigger an automatic import. You can also import the modules into your session by using the `Import-Module` cmdlet. -Starting in Windows PowerShell 3.0, you can get and then, import modules from remote sessions into the local session. +Beginning in Windows PowerShell 3.0, you can get (and then, import) modules from remote sessions into the local session. This strategy uses the Implicit Remoting feature of Windows PowerShell and is equivalent to using the `Import-PSSession` cmdlet. -When you use commands in modules imported from another session, the commands run implicitly in the remote session. -This feature lets you manage the remote computer from the local session. +When you use commands in modules imported from another session, the commands run implicitly in the remote session, allowing you to manage the remote computer from the local session. -Also, starting in Windows PowerShell 3.0, you can use `Get-Module` and `Import-Module` to get and import Common Information Model (CIM) modules, in which the cmdlets are defined in Cmdlet Definition XML (CDXML) files. -This feature lets you use cmdlets that are implemented in non-managed code assemblies, such as those written in C++. +Also, beginning in Windows PowerShell 3.0, you can use `Get-Module` and `Import-Module` to get and import Common Information Model (CIM) modules, in which the cmdlets are defined in Cmdlet Definition XML (CDXML) files. +This feature allows you to use cmdlets that are implemented in non-managed code assemblies, such as those written in C++. -With these new features, the `Get-Module` and `Import-Module` cmdlets become primary tools for managing heterogeneous enterprises that include computers that run the Windows operating system and computers that run other operating systems. +With these new features, the `Get-Module` and `Import-Module` cmdlets become primary tools for managing heterogeneous enterprises that include Windows computers and computers that are running other operating systems. -To manage remote computers that run the Windows operating system that have Windows PowerShell and Windows PowerShell remoting enabled, create a **PSSession** on the remote computer and then use the **PSSession** parameter of `Get-Module` to get the Windows PowerShell modules in the **PSSession**. +To manage remote Windows computers that have Windows PowerShell and Windows PowerShell remoting enabled, create a **PSSession** on the remote computer and then use the **PSSession** parameter of `Get-Module` to get the Windows PowerShell modules in the **PSSession**. When you import the modules, and then use the imported commands in the current session, the commands run implicitly in the **PSSession** on the remote computer. You can use this strategy to manage the remote computer. -You can use a similar strategy to manage computers that do not have Windows PowerShell remoting enabled. -These include computers that are not running the Windows operating system, and computers that have Windows PowerShell but do not have Windows PowerShell remoting enabled. +You can use a similar strategy to manage computers that do not have Windows PowerShell remoting enabled, including computers that are not running a Windows operating system, and Windows computers that have Windows PowerShell, but do not have Windows PowerShell remoting enabled. -Start by creating a CIM session on the remote computer. -A CIM session is a connection to Windows Management Instrumentation (WMI) on the remote computer. +Begin by creating a "CIM session" on the remote computer; a connection to Windows Management Instrumentation (WMI) on the remote computer. Then use the **CIMSession** parameter of `Get-Module` to get CIM modules from the CIM session. -When you import a CIM module by using the `Import-Module` cmdlet and then run the imported commands, the commands run implicitly on the remote computer. +When you import a CIM module (by using the `Import-Module` cmdlet) and then run the imported commands, the commands run implicitly on the remote computer. You can use this WMI and CIM strategy to manage the remote computer. ## EXAMPLES @@ -120,8 +116,8 @@ Name Version Microsoft.PowerShell.Management 3.1.0.0 ``` -This command gets the **Microsoft.PowerShell.Management** module by specifying the fully qualified name of the module by using the **FullyQualifiedName** parameter. -The command then pipes the results into the `Format-Table` cmdlet to format the results as a table with **Name** and **Version** as the column headings. +This command gets the **Microsoft.PowerShell.Management** module by specifying the module's fully qualified name, with the **FullyQualifiedName** parameter. +The command then pipes the results into `Format-Table`, to format the results as a table with **Name** and **Version** as the column headings. ### Example 5: Get properties of a module @@ -176,9 +172,9 @@ This command gets the properties of the **PSModuleInfo** object that `Get-Module There is one object for each module file. You can use the properties to format and filter the module objects. -For more information about the properties, see [PSModuleInfo Properties](http://go.microsoft.com/fwlink/?LinkId=143624) in the MSDN library. +For more information about the properties, see [PSModuleInfo Properties](/dotnet/api/system.management.automation.psmoduleinfo). -The output includes the new properties, such as **Author** and **CompanyName**, that were introduced in Windows PowerShell 3.0. +The output includes the new properties, such as **Author** and **CompanyName**, that were introduced in Windows PowerShell 3.0 ### Example 6: Group all modules by name @@ -241,7 +237,7 @@ PS> Get-Content $m.Path GUID = "{8FA5064B-8479-4c5c-86EA-0D311FE48875}" Author = "Microsoft Corporation" CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." + Copyright = "Microsoft Corporation. All rights reserved." ModuleVersion = "1.0.0.0" Description = "Windows PowerShell File Transfer Module" PowerShellVersion = "2.0" @@ -272,7 +268,7 @@ d---- 12/16/2008 12:36 PM en-US -a--- 12/16/2008 12:20 AM 108544 Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll ``` -This command lists the files in the directory of the module. +This command lists the files in the module's directory. This is another way to determine what is in a module before you import it. Some modules might have help files or ReadMe files that describe the module. @@ -335,8 +331,8 @@ The fourth command runs the `Get-Disk` command. Although the command is typed in ### -All -Indicates that this cmdlet gets all modules in each module folder, including nested modules, manifest (.psd1) files, script module (.psm1) files, and binary module (.dll) files. -Without this parameter, `Get-Module` gets only the default module in each module folder. +Gets all modules in each module folder, including nested modules, manifest (.psd1) files, script module (.psm1) files, and binary module (.dll) files. +Without the **All** parameter, `Get-Module` gets only the default module in each module folder. ```yaml Type: SwitchParameter @@ -345,7 +341,7 @@ Aliases: Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` @@ -355,7 +351,7 @@ Accept wildcard characters: False Specifies the namespace of an alternate CIM provider that exposes CIM modules. The default value is the namespace of the Module Discovery WMI provider. -Use this parameter to get CIM modules from computers and devices that are not running the Windows operating system. +Use this parameter to get CIM modules from computers and devices that are not running a Windows operating system. This parameter was introduced in Windows PowerShell 3.0. @@ -444,7 +440,7 @@ Accept wildcard characters: False ### -ListAvailable -Indicates that this cmdlet gets all installed modules. +Gets all installed modules. `Get-Module` gets modules in paths listed in the **PSModulePath** environment variable. Without this parameter, `Get-Module` gets only the modules that are both listed in the **PSModulePath** environment variable, and that are loaded in the current session. **ListAvailable** does not return information about modules that are not found in the **PSModulePath** environment variable, even if those modules are loaded in the current session. @@ -500,9 +496,9 @@ Accept wildcard characters: False Gets the modules in the specified user-managed Windows PowerShell session (**PSSession**). Enter a variable that contains the session, a command that gets the session, such as a `Get-PSSession` command, or a command that creates the session, such as a `New-PSSession` command. -When the session is connected to a remote computer, you must specify the **ListAvailable** parameter. +When the session is connected to a remote computer, the **ListAvailable** parameter is required. -A `Get-Module` command that uses the **PSSession** parameter is equivalent to using the `Invoke-Command` cmdlet to run a `Get-Module -ListAvailable` command in a **PSSession**. +A `Get-Module` command with the **PSSession** parameter is equivalent to using the `Invoke-Command` cmdlet to run a `Get-Module -ListAvailable` command in a **PSSession**. This parameter was introduced in Windows PowerShell 3.0. @@ -520,24 +516,24 @@ Accept wildcard characters: False ### -Refresh -Indicates that this cmdlet refreshes the cache of installed commands. +Refreshes the cache of installed commands. The command cache is created when the session starts. It enables the `Get-Command` cmdlet to get commands from modules that are not imported into the session. This parameter is designed for development and testing scenarios in which the contents of modules have changed since the session started. -When you specify the **Refresh** parameter in a command, you must specify **ListAvailable**. +When the **Refresh** parameter is used in a command, the **ListAvailable** parameter is required. This parameter was introduced in Windows PowerShell 3.0. ```yaml Type: SwitchParameter -Parameter Sets: CimSession, Available, PsSession +Parameter Sets: CimSession, PsSession, Available Aliases: Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` @@ -562,15 +558,15 @@ When you specify the **ListAvailable** parameter, `Get-Module` returns a **Modul ## NOTES - Beginning in Windows PowerShell 3.0, the core commands that are included in Windows PowerShell are packaged in modules. The exception is **Microsoft.PowerShell.Core**, which is a snap-in (**PSSnapin**). By default, only the **Microsoft.PowerShell.Core** snap-in is added to the session. Modules are imported automatically on first use and you can use the `Import-Module` cmdlet to import them. -- Starting in Windows PowerShell 3.0, the core commands that are installed with Windows PowerShell are packaged in modules. In Windows PowerShell 2.0, and in host programs that create older-style sessions in later versions of Windows PowerShell, the core commands are packaged in snap-ins (**PSSnapins**). The exception is **Microsoft.PowerShell.Core**, which is always a snap-in. Also, remote sessions, such as those started by the `New-PSSession` cmdlet, are older-style sessions that include core snap-ins. +- Beginning in Windows PowerShell 3.0, the core commands that are installed with Windows PowerShell are packaged in modules. In Windows PowerShell 2.0, and in host programs that create older-style sessions in later versions of Windows PowerShell, the core commands are packaged in snap-ins (**PSSnapins**). The exception is **Microsoft.PowerShell.Core**, which is always a snap-in. Also, remote sessions, such as those started by the `New-PSSession` cmdlet, are older-style sessions that include core snap-ins. - For information about the **CreateDefault2** method that creates newer-style sessions with core modules, see [CreateDefault2 Method](https://msdn.microsoft.com/library/system.management.automation.runspaces.initialsessionstate.createdefault2) in the MSDN library. + For information about the **CreateDefault2** method that creates newer-style sessions with core modules, see [CreateDefault2 Method](/dotnet/api/system.management.automation.runspaces.initialsessionstate.createdefault2) in the MSDN library. -- `Get-Module` gets only modules in locations that are stored in the value of the **PSModulePath** environment variable ($env:PSModulePath). You can use the **Path** parameter of the `Import-Module` cmdlet to import modules in other locations, but you cannot use the `Get-Module` cmdlet to get them. -- Also, starting in Windows PowerShell 3.0, new properties have been added to the object that `Get-Module` returns that make it easier to learn about modules even before they are imported. All properties are populated before importing. These include the **ExportedCommands**, **ExportedCmdlets** and **ExportedFunctions** properties that list the commands that the module exports. -- The **ListAvailable** parameter gets only well-formed modules, that is, folders that contain at least one file whose base name is the same as the name of the module folder. The base name is the name without the file name extension. Folders that contain files that have different names are considered to be containers, but not modules. +- `Get-Module` only gets modules in locations that are stored in the value of the **PSModulePath** environment variable ($env:PSModulePath). You can use the **Path** parameter of the `Import-Module` cmdlet to import modules in other locations, but you cannot use the `Get-Module` cmdlet to get them. +- Also, beginning in Windows PowerShell 3.0, new properties have been added to the object that `Get-Module` returns that make it easier to learn about modules even before they are imported. All properties are populated before importing, including the **ExportedCommands**, **ExportedCmdlets** and **ExportedFunctions** properties that list the commands that the module exports. +- The **ListAvailable** parameter gets only well-formed modules, that is, folders that contain at least one file whose base name (the name without the file name extension) is the same as the name of the module folder. Folders that contain files with different names are considered to be containers, but not modules. - To get modules that are implemented as .dll files, but are not enclosed in a module folder, specify both the **ListAvailable** and **All** parameters. + To get modules that are implemented as .dll files, but are not enclosed in a module folder, use both the **ListAvailable** and **All** parameters. - To use the CIM session feature, the remote computer must have WS-Management remoting and Windows Management Instrumentation (WMI), which is the Microsoft implementation of the Common Information Model (CIM) standard. The computer must also have the Module Discovery WMI provider or an alternate WMI provider that has the same basic features. diff --git a/reference/5.0/Microsoft.PowerShell.Core/Invoke-Command.md b/reference/5.0/Microsoft.PowerShell.Core/Invoke-Command.md index 44f0f5f1bd48..9b3e1041daf9 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/Invoke-Command.md +++ b/reference/5.0/Microsoft.PowerShell.Core/Invoke-Command.md @@ -7,35 +7,39 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821493 external help file: System.Management.Automation.dll-Help.xml title: Invoke-Command --- - # Invoke-Command ## SYNOPSIS + Runs commands on local and remote computers. ## SYNTAX ### InProcess (Default) + ``` Invoke-Command [-ScriptBlock] [-NoNewScope] [-InputObject ] [-ArgumentList ] [] ``` -### Session +### FilePathRunspace + ``` Invoke-Command [[-Session] ] [-ThrottleLimit ] [-AsJob] [-HideComputerName] - [-JobName ] [-ScriptBlock] [-InputObject ] [-ArgumentList ] + [-JobName ] [-FilePath] [-InputObject ] [-ArgumentList ] [] ``` -### FilePathRunspace +### Session + ``` Invoke-Command [[-Session] ] [-ThrottleLimit ] [-AsJob] [-HideComputerName] - [-JobName ] [-FilePath] [-InputObject ] [-ArgumentList ] + [-JobName ] [-ScriptBlock] [-InputObject ] [-ArgumentList ] [] ``` ### ComputerName + ``` Invoke-Command [[-ComputerName] ] [-Credential ] [-Port ] [-UseSSL] [-ConfigurationName ] [-ApplicationName ] [-ThrottleLimit ] [-AsJob] @@ -46,6 +50,7 @@ Invoke-Command [[-ComputerName] ] [-Credential ] [-Port ``` ### FilePathComputerName + ``` Invoke-Command [[-ComputerName] ] [-Credential ] [-Port ] [-UseSSL] [-ConfigurationName ] [-ApplicationName ] [-ThrottleLimit ] [-AsJob] @@ -92,6 +97,7 @@ Invoke-Command -Credential [-ThrottleLimit ] [-AsJob] [-Hi ``` ### Uri + ``` Invoke-Command [-Credential ] [-ConfigurationName ] [-ThrottleLimit ] [[-ConnectionUri] ] [-AsJob] [-InDisconnectedSession] [-HideComputerName] [-JobName ] @@ -101,6 +107,7 @@ Invoke-Command [-Credential ] [-ConfigurationName ] [-Thro ``` ## DESCRIPTION + The **Invoke-Command** cmdlet runs commands on a local or remote computer and returns all output from the commands, including errors. By using a single **Invoke-Command** command, you can run commands on multiple computers. @@ -387,8 +394,8 @@ As a result, if the remote computer specified by *ConnectionURI* returns a redir ### Example 14: Use a session option ``` -PS C:\> $so = New-PSSessionOption -SkipCACheck -SkipCNCheck –SkipRevocationCheck -PS C:\> Invoke-Command -ComputerName server01 -UseSSL -ScriptBlock { Get-HotFix } -SessionOption $so -Credential server01\user01 +PS> $so = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck +PS> Invoke-Command -ComputerName server01 -UseSSL -ScriptBlock { Get-Hotfix } -SessionOption $so -Credential server01\user01 ``` This example shows how to create and use a *SessionOption* parameter. diff --git a/reference/5.0/Microsoft.PowerShell.Core/New-ModuleManifest.md b/reference/5.0/Microsoft.PowerShell.Core/New-ModuleManifest.md index 54dc22bc0cc3..8a2ce5158d66 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/New-ModuleManifest.md +++ b/reference/5.0/Microsoft.PowerShell.Core/New-ModuleManifest.md @@ -7,7 +7,6 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821496 external help file: System.Management.Automation.dll-Help.xml title: New-ModuleManifest --- - # New-ModuleManifest ## SYNOPSIS @@ -242,7 +241,7 @@ Author : Microsoft Corporation AccessMode : ReadWrite ClrVersion : 4.0 CompanyName : Microsoft Corporation -Copyright : © Microsoft Corporation. All rights reserved. +Copyright : Microsoft Corporation. All rights reserved. DotNetFrameworkVersion : ExportedFunctions : {} ExportedCmdlets : {[Get-WinEvent, Get-WinEvent], [Get-Counter, Get-Counter], [Import-Counter, diff --git a/reference/5.0/Microsoft.PowerShell.Core/Receive-PSSession.md b/reference/5.0/Microsoft.PowerShell.Core/Receive-PSSession.md index c1a05d0f6c34..42018a5c53fc 100644 --- a/reference/5.0/Microsoft.PowerShell.Core/Receive-PSSession.md +++ b/reference/5.0/Microsoft.PowerShell.Core/Receive-PSSession.md @@ -7,27 +7,30 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821506 external help file: System.Management.Automation.dll-Help.xml title: Receive-PSSession --- - # Receive-PSSession ## SYNOPSIS -Gets results of commands in disconnected sessions. + +Gets results of commands in disconnected sessions ## SYNTAX ### Session (Default) + ``` Receive-PSSession [-Session] [-OutTarget ] [-JobName ] [-WhatIf] [-Confirm] [] ``` ### Id + ``` Receive-PSSession [-Id] [-OutTarget ] [-JobName ] [-WhatIf] [-Confirm] [] ``` ### ComputerSessionName + ``` Receive-PSSession [-ComputerName] [-ApplicationName ] [-ConfigurationName ] -Name [-OutTarget ] [-JobName ] [-Credential ] @@ -36,6 +39,7 @@ Receive-PSSession [-ComputerName] [-ApplicationName ] [-Configu ``` ### ComputerInstanceId + ``` Receive-PSSession [-ComputerName] [-ApplicationName ] [-ConfigurationName ] -InstanceId [-OutTarget ] [-JobName ] [-Credential ] @@ -44,6 +48,7 @@ Receive-PSSession [-ComputerName] [-ApplicationName ] [-Configu ``` ### ConnectionUriInstanceId + ``` Receive-PSSession [-ConfigurationName ] [-ConnectionUri] [-AllowRedirection] -InstanceId [-OutTarget ] [-JobName ] [-Credential ] @@ -52,6 +57,7 @@ Receive-PSSession [-ConfigurationName ] [-ConnectionUri] [-AllowRe ``` ### ConnectionUriSessionName + ``` Receive-PSSession [-ConfigurationName ] [-ConnectionUri] [-AllowRedirection] -Name [-OutTarget ] [-JobName ] [-Credential ] @@ -60,37 +66,41 @@ Receive-PSSession [-ConfigurationName ] [-ConnectionUri] [-AllowRe ``` ### InstanceId + ``` Receive-PSSession -InstanceId [-OutTarget ] [-JobName ] [-WhatIf] [-Confirm] [] ``` ### SessionName + ``` Receive-PSSession -Name [-OutTarget ] [-JobName ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION + The **Receive-PSSession** cmdlet gets the results of commands running in Windows PowerShell sessions (**PSSession**) that were disconnected. If the session is currently connected, **Receive-PSSession** gets the results of commands that were running when the session was disconnected. If the session is still disconnected, **Receive-PSSession** connects to the session, resumes any commands that were suspended, and gets the results of commands running in the session. You can use a **Receive-PSSession** in addition to or instead of a Connect-PSSession command. **Receive-PSSession** can connect to any disconnected or reconnected session. -These include those that were started in other sessions or on other computers. +These includes those that were started in other sessions or on other computers. **Receive-PSSession** works on **PSSessions** that were disconnected intentionally, such as by using the Disconnect-PSSession cmdlet or the *InDisconnectedSession* parameter of the Invoke-Command cmdlet, or unintentionally, such as by a network interruption. If you use the **Receive-PSSession** cmdlet to connect to a session in which no commands are running or suspended, **Receive-PSSession** connects to the session, but returns no output or errors. -For more information about the Disconnected Sessions feature, see about_Remote_Disconnected_Sessions. +For more information about the Disconnected Sessions feature, see [about_Remote_Disconnected_Sessions](./About/about_Remote_Disconnected_Sessions.md). This cmdlet was introduced in Windows PowerShell 3.0. ## EXAMPLES ### Example 1: Connect to a PSSession + ``` PS C:\> Receive-PSSession -ComputerName Server01 -Name ITTask ``` @@ -100,6 +110,7 @@ This command uses the **Receive-PSSession** cmdlet to connect to the ITTask sess Because the command does not use the *OutTarget* parameter, the results appear at the command line. ### Example 2: Get results of all commands on disconnected sessions + ``` PS C:\> Get-PSSession -ComputerName Server01, Server02 | Receive-PSSession ``` @@ -109,6 +120,7 @@ This command gets the results of all commands running in all disconnected sessio If any session was not disconnected or is not running commands, **Receive-PSSession** does not connect to the session and does not return any output or errors. ### Example 3: Get the results of a script running in a session + ``` PS C:\> Receive-PSSession -ComputerName Server01 -Name ITTask -OutTarget Job -JobName ITTaskJob01 -Credential Domain01\Admin01 Id Name State HasMoreData Location @@ -127,6 +139,7 @@ The output shows that **Receive-PSSession** returned the results as a job in the To get the job results, use a Receive-Job command ### Example 4: Get results after a network outage + ``` The first command uses the New-PSSession cmdlet to create a session on the Server01 computer. The command saves the session in the $s variable.The second command gets the session in the $s variable. Notice that the **State** is Opened and the **Availability** is Available. These values indicate that you are connected to the session and can run commands in the session. PS C:\> $s = New-PSSession -ComputerName Server01 -Name AD -ConfigurationName ADEndpoint @@ -136,9 +149,9 @@ Id Name ComputerName State ConfigurationName Availability -- ---- ------------ ----- ----------------- ------------ 8 AD Server01 Opened ADEndpoint Available -The third command uses the Invoke-Command cmdlet to run a script in the session in the $s variable.The script starts to run and return data, but a network outage occurs that interrupts the session. The user has to exit the session and restart the local computer. -PS C:\> Invoke-Command -Session $s -FilePath \\Server12\Scripts\SharedScripts\New-ADResolve.ps1 - Running "New-ADResolve.ps1" ….exit +The third command uses the Invoke-Command cmdlet to run a script in the session in the $s variable.The script begins to run and return data, but a network outage occurs that interrupts the session. The user has to exit the session and restart the local computer. +PS> Invoke-Command -Session $s -FilePath \\Server12\Scripts\SharedScripts\New-ADResolve.ps1 + Running "New-ADResolve.ps1" # Network outage # Restart local computer @@ -171,6 +184,7 @@ This example uses the **Receive-PSSession** cmdlet to get the results of a job a Windows PowerShell automatically attempts to reconnect the session one time each second for the next four minutes and abandons the effort only if all attempts in the four-minute interval fail. ### Example 5: Reconnect to disconnected sessions + ``` The first command uses the Invoke-Command cmdlet to run a script on the three remote computers. Because the scripts gathers and summarize data from multiple databases, it often takes the script an extended time to finish. The command uses the *InDisconnectedSession* parameter, which starts the scripts and then immediately disconnects the sessions.The command uses the *SessionOption* parameter to extend the **IdleTimeout** value of the disconnected session. Disconnected sessions are considered to be idle from the moment they are disconnected, so it is important to set the idle time-out for long enough that the commands can complete and you can reconnect to the session, if necessary. You can set the **IdleTimeout** only when you create the **PSSession** and change it only when you disconnect from it. You cannot change the **IdleTimeout** value when you connect to a **PSSession** or receiving its results.After running the command, the user exits Windows PowerShell and closes the computer . PS C:\> Invoke-Command -InDisconnectedSession -ComputerName Server01, Server02, Server30 -FilePath \\Server12\Scripts\SharedScripts\Get-BugStatus.ps1 -Name BugStatus -SessionOption @{IdleTimeout = 86400000} -ConfigurationName ITTasks# Exit @@ -203,12 +217,13 @@ Bug Report - Domain 01 ---------------------- ComputerName BugCount LastUpdated -------------- --------- ------------ -Server01 121 Friday, December 30, 2011 5:03:34 PM… +Server01 121 Friday, December 30, 2011 5:03:34 PM ``` This example uses the **Receive-PSSession** cmdlet to reconnect to sessions that were intentionally disconnected and get the results of jobs that were running in the sessions. ### Example 6: Running a job in a disconnected session + ``` The first command uses the New-PSSession cmdlet to create the Test session on the Server01 computer. The command saves the session in the $s variable. PS C:\> $s = New-PSSession -ComputerName Server01 -Name Test @@ -235,7 +250,8 @@ Id Name State HasMoreData Location The sixth command runs a Receive-Job command on the job in the $j variable. The output shows that the job began to return output before the session and the job were disconnected. PS C:\> Receive-Job $j -Keep -Return 1Return 2 +Return 1 +Return 2 The seventh command is run in the same client session. The command uses the Connect-PSSession cmdlet to reconnect to the Test session on the Server01 computer and saves the session in the $s2 variable. PS C:\> $s2 = Connect-PSSession -ComputerName Server01 -Name Test @@ -245,7 +261,7 @@ PS C:\> $j2 = Receive-PSSession -ComputerName Server01 -Name Test PS C:\> Receive-Job $j Return 3 -Return 4… +Return 4 ``` This example shows what happens to a job that is running in a disconnected session. @@ -253,14 +269,18 @@ This example shows what happens to a job that is running in a disconnected sessi ## PARAMETERS ### -AllowRedirection -Indicates that this cmdlet allows redirection of this connection to an alternate Uniform Resource Identifier (URI). -When you use the *ConnectionURI* parameter, the remote destination can return an instruction to redirect to a different URI. -By default, Windows PowerShell does not redirect connections, but you can use this parameter to enable it to redirect the connection. +Indicates that this cmdlet allows redirection of this connection to an alternate Uniform Resource +Identifier (URI). + +When you use the *ConnectionURI* parameter, the remote destination can return an instruction to +redirect to a different URI. By default, Windows PowerShell does not redirect connections, but you +can use this parameter to enable it to redirect the connection. -You can also limit the number of times the connection is redirected by changing the **MaximumConnectionRedirectionCount** session option value. -Use the *MaximumRedirection* parameter of the New-PSSessionOption cmdlet or set the **MaximumConnectionRedirectionCount** property of the $PSSessionOption preference variable. -The default value is 5. +You can also limit the number of times the connection is redirected by changing the +**MaximumConnectionRedirectionCount** session option value. Use the *MaximumRedirection* parameter +of the New-PSSessionOption cmdlet or set the **MaximumConnectionRedirectionCount** property of the +$PSSessionOption preference variable. The default value is 5. ```yaml Type: SwitchParameter @@ -275,15 +295,15 @@ Accept wildcard characters: False ``` ### -ApplicationName -Specifies an application. -This cmdlet connects only to sessions that use the specified application. -Enter the application name segment of the connection URI. -For example, in the following connection URI, the application name is WSMan: `http://localhost:5985/WSMAN`. -The application name of a session is stored in the **Runspace.ConnectionInfo.AppName** property of the session. +Specifies an application. This cmdlet connects only to sessions that use the specified application. -The value of this parameter is used to select and filter sessions. -It does not change the application that the session uses. +Enter the application name segment of the connection URI. For example, in the following connection +URI, the application name is WSMan: `http://localhost:5985/WSMAN`. The application name of a session +is stored in the **Runspace.ConnectionInfo.AppName** property of the session. + +The value of this parameter is used to select and filter sessions. It does not change the +application that the session uses. ```yaml Type: String @@ -297,9 +317,10 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -Authentication -Specifies the mechanism that is used to authenticate the credentials of the user in the command to reconnect to the disconnected session. -The acceptable values for this parameter are: +### Authentication + +Specifies the mechanism that is used to authenticate the credentials of the user in the command to +reconnect to the disconnected session. The acceptable values for this parameter are: - Default - Basic @@ -311,11 +332,15 @@ The acceptable values for this parameter are: The default value is Default. -For more information about the values of this parameter, see [AuthenticationMechanism Enumeration](https://msdn.microsoft.com/library/system.management.automation.runspaces.authenticationmechanism) in the MSDN library. +For more information about the values of this parameter, see +[AuthenticationMechanism Enumeration](https://msdn.microsoft.com/library/system.management.automation.runspaces.authenticationmechanism). -CAUTION: Credential Security Support Provider (CredSSP) authentication, in which the user credentials are passed to a remote computer to be authenticated, is designed for commands that require authentication on more than one resource, such as accessing a remote network share. -This mechanism increases the security risk of the remote operation. -If the remote computer is compromised, the credentials that are passed to it can be used to control the network session. +> [!CAUTION] +> Credential Security Support Provider (CredSSP) authentication, in which the user credentials are +> passed to a remote computer to be authenticated, is designed for commands that require +> authentication on more than one resource, such as accessing a remote network share. This mechanism +> increases the security risk of the remote operation. If the remote computer is compromised, the +> credentials that are passed to it can be used to control the network session. ```yaml Type: AuthenticationMechanism @@ -331,14 +356,15 @@ Accept wildcard characters: False ``` ### -CertificateThumbprint -Specifies the digital public key certificate (X509) of a user account that has permission to connect to the disconnected session. -Enter the certificate thumbprint of the certificate. -Certificates are used in client certificate-based authentication. -They can be mapped only to local user accounts. -They do not work with domain accounts. +Specifies the digital public key certificate (X509) of a user account that has permission to connect +to the disconnected session. Enter the certificate thumbprint of the certificate. -To get a certificate thumbprint, use a Get-Item or Get-ChildItem command in the Windows PowerShell Cert: drive. +Certificates are used in client certificate-based authentication. They can be mapped only to local +user accounts. They do not work with domain accounts. + +To get a certificate thumbprint, use a Get-Item or Get-ChildItem command in the Windows PowerShell +Cert: drive. ```yaml Type: String @@ -353,13 +379,14 @@ Accept wildcard characters: False ``` ### -ComputerName -Specifies the computer on which the disconnected session is stored. -Sessions are stored on the computer that is at the server-side, or receiving end of a connection. -The default is the local computer. -Type the NetBIOS name, an IP address, or a fully qualified domain name of one computer. -Wildcard characters are not permitted. -To specify the local computer, type the computer name, localhost, or a dot (.) +Specifies the computer on which the disconnected session is stored. Sessions are stored on the +computer that is at the server-side, or receiving end of a connection. The default is the local +computer. + +Type the NetBIOS name, an IP address, or a fully qualified domain name of one computer. Wildcard +characters are not permitted. To specify the local computer, type the computer name, localhost, or a +dot (.) ```yaml Type: String @@ -374,15 +401,16 @@ Accept wildcard characters: False ``` ### -ConfigurationName -Specifies the name of a session configuration. -This cmdlet connects only to sessions that use the specified session configuration. -Enter a configuration name or the fully qualified resource URI for a session configuration. -If you specify only the configuration name, the following schema URI is prepended: http://schemas.microsoft.com/powershell. -The configuration name of a session is stored in the **ConfigurationName** property of the session. +Connects only to sessions that use the specified session configuration. + +Enter a configuration name or the fully qualified resource URI for a session configuration. If you +specify only the configuration name, the following schema URI is prepended: +`http://schemas.microsoft.com/powershell`. The configuration name of a session is stored in the +**ConfigurationName** property of the session. -The value of this parameter is used to select and filter sessions. -It does not change the session configuration that the session uses. +The value of this parameter is used to select and filter sessions. It does not change the session +configuration that the session uses. For more information about session configurations, see [about_Session_Configurations](About/about_Session_Configurations.md). @@ -399,6 +427,7 @@ Accept wildcard characters: False ``` ### -Confirm + Prompts you for confirmation before running the cmdlet. ```yaml @@ -414,26 +443,26 @@ Accept wildcard characters: False ``` ### -ConnectionUri + Specifies a URI that defines the connection endpoint that is used to reconnect to the disconnected session. -The URI must be fully qualified. -The format of this string is as follows: +The URI must be fully qualified. The format of this string is as follows: -\://\:\/\ +`://:/` The default value is as follows: `http://localhost:5985/WSMAN` -`http://localhost:5985/WSMAN` - -If you do not specify a connection URI, you can use the *UseSSL*, *ComputerName*, *Port*, and *ApplicationName* parameters to specify the connection URI values. +If you do not specify a connection URI, you can use the **UseSSL**, **ComputerName**, **Port**, and +**ApplicationName** parameters to specify the connection URI values. -Valid values for the Transport segment of the URI are HTTP and HTTPS. -If you specify a connection URI with a Transport segment, but do not specify a port, the session is created with standards ports: 80 for HTTP and 443 for HTTPS. -To use the default ports for Windows PowerShell remoting, specify port 5985 for HTTP or 5986 for HTTPS. +Valid values for the **Transport** segment of the URI are HTTP and HTTPS. If you specify a +connection URI with a Transport segment, but do not specify a port, the session is created with +standards ports: 80 for HTTP and 443 for HTTPS. To use the default ports for Windows PowerShell +remoting, specify port 5985 for HTTP or 5986 for HTTPS. -If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the *AllowRedirection* parameter in the command. +If the destination computer redirects the connection to a different URI, Windows PowerShell prevents the redirection unless you use the **AllowRedirection** parameter in the command. ```yaml Type: Uri @@ -442,18 +471,19 @@ Aliases: URI, CU Required: True Position: 0 -Default value: None +Default value: http://localhost:5985/WSMAN Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -Credential -Specifies a user account that has permission to connect to the disconnected session. -The default is the current user. -Type a user name, such as User01 or Domain01\User01. -Or, enter a **PSCredential** object, such as one generated by the Get-Credential cmdlet. -If you type a user name, this cmdlet prompts you for a password. +Specifies a user account that has permission to connect to the disconnected session. The default is +the current user. + +Type a user name, such as User01 or Domain01\User01. Or, enter a **PSCredential** object, such as +one generated by the Get-Credential cmdlet. If you type a user name, this cmdlet prompts you for a +password. ```yaml Type: PSCredential @@ -468,10 +498,12 @@ Accept wildcard characters: False ``` ### -Id -Specifies the ID of the disconnected session. -The *Id* parameter works only when the disconnected session was previously connected to the current session. -This parameter is valid, but not effective, when the session is stored on the local computer, but was not connected to the current session. +Specifies the ID of the disconnected session. The *Id* parameter works only when the disconnected +session was previously connected to the current session. + +This parameter is valid, but not effective, when the session is stored on the local computer, but +was not connected to the current session. ```yaml Type: Int32 @@ -486,6 +518,7 @@ Accept wildcard characters: False ``` ### -InstanceId + Specifies the instance ID of the disconnected session. The instance ID is a GUID that uniquely identifies a **PSSession** on a local or remote computer. @@ -494,19 +527,7 @@ The instance ID is stored in the **InstanceID** property of the **PSSession**. ```yaml Type: Guid -Parameter Sets: ComputerInstanceId, ConnectionUriInstanceId -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -```yaml -Type: Guid -Parameter Sets: InstanceId +Parameter Sets: ComputerInstanceId, ConnectionUriInstanceId, InstanceId Aliases: Required: True @@ -517,16 +538,22 @@ Accept wildcard characters: False ``` ### -JobName + Specifies a friendly name for the job that **Receive-PSSession** returns. -**Receive-PSSession** returns a job when the value of the *OutTarget* parameter is Job or the job that is running in the disconnected session was started in the current session. +**Receive-PSSession** returns a job when the value of the *OutTarget* parameter is Job or the job +that is running in the disconnected session was started in the current session. -If the job that is running in the disconnected session was started in the current session, Windows PowerShell reuses the original job object in the session and ignores the value of the *JobName* parameter. +If the job that is running in the disconnected session was started in the current session, Windows +PowerShell reuses the original job object in the session and ignores the value of the *JobName* +parameter. -If the job that is running in the disconnected session was started in a different session, Windows PowerShell creates a new job object. -It uses a default name, but you can use this parameter to change the name. +If the job that is running in the disconnected session was started in a different session, Windows +PowerShell creates a new job object. It uses a default name, but you can use this parameter to +change the name. -If the default value or explicit value of the *OutTarget* parameter is not Job, the command succeeds, but the *JobName* parameter has no effect. +If the default value or explicit value of the *OutTarget* parameter is not Job, the command +succeeds, but the *JobName* parameter has no effect. ```yaml Type: String @@ -541,23 +568,12 @@ Accept wildcard characters: False ``` ### -Name -Specifies the friendly name of the disconnected session. -```yaml -Type: String -Parameter Sets: ComputerSessionName, ConnectionUriSessionName -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` +Specifies the friendly name of the disconnected session. ```yaml Type: String -Parameter Sets: SessionName +Parameter Sets: ComputerSessionName, ConnectionUriSessionName, SessionName Aliases: Required: True @@ -568,22 +584,21 @@ Accept wildcard characters: False ``` ### -OutTarget -Determines how the session results are returned. -The acceptable values for this parameter are: -- Job. -Returns the results asynchronously in a job object. -You can use the *JobName* parameter to specify a name or new name for the job. -- Host. -Returns the results to the command line (synchronously). -If the command is being resumed or the results consist of a large number of objects, the response might be delayed. +Determines how the session results are returned. The acceptable values for this parameter are: + +- Job. Returns the results asynchronously in a job object. You can use the *JobName* parameter to + specify a name or new name for the job. +- Host. Returns the results to the command line (synchronously). If the command is being resumed or + the results consist of a large number of objects, the response might be delayed. -The default value of the *OutTarget* parameter is Host. -However, if the command that is being received in disconnected session was started in the current session, the default value of the *OutTarget* parameter is the form in which the command was started. -If the command was started as a job, it is returned as a job by default. -Otherwise, it is returned to the host program by default. +The default value of the *OutTarget* parameter is Host. However, if the command that is being +received in disconnected session was started in the current session, the default value of the +*OutTarget* parameter is the form in which the command was started. If the command was started as a +job, it is returned as a job by default. Otherwise, it is returned to the host program by default. -Typically, the host program displays returned objects at the command line without delay, but this behavior can vary. +Typically, the host program displays returned objects at the command line without delay, but this +behavior can vary. ```yaml Type: OutTarget @@ -599,20 +614,23 @@ Accept wildcard characters: False ``` ### -Port -Specifies the network port on the remote computer that is used to reconnect to the session. -To connect to a remote computer, the remote computer must be listening on the port that the connection uses. -The default ports are 5985, which is the WinRM port for HTTP, and 5986, which is the WinRM port for HTTPS. -Before using an alternate port, you must configure the WinRM listener on the remote computer to listen at that port. -To configure the listener, type the following two commands at the Windows PowerShell prompt: +Specifies the network port on the remote computer that is used to reconnect to the session. To +connect to a remote computer, the remote computer must be listening on the port that the connection +uses. The default ports are 5985, which is the WinRM port for HTTP, and 5986, which is the WinRM +port for HTTPS. + +Before using an alternate port, you must configure the WinRM listener on the remote computer to +listen at that port. To configure the listener, type the following two commands at the Windows +PowerShell prompt: `Remove-Item -Path WSMan:\Localhost\listener\listener* -Recurse` `New-Item -Path WSMan:\Localhost\listener -Transport http -Address * -Port \` -Do not use the *Port* parameter unless you must. -The port that is set in the command applies to all computers or sessions on which the command runs. -An alternate port setting might prevent the command from running on all computers. +Do not use the *Port* parameter unless you must. The port that is set in the command applies to all +computers or sessions on which the command runs. An alternate port setting might prevent the command +from running on all computers. ```yaml Type: Int32 @@ -627,8 +645,9 @@ Accept wildcard characters: False ``` ### -Session -Specifies the disconnected session. -Enter a variable that contains the **PSSession** or a command that creates or gets the **PSSession**, such as a Get-PSSession command. + +Specifies the disconnected session. Enter a variable that contains the **PSSession** or a command +that creates or gets the **PSSession**, such as a Get-PSSession command. ```yaml Type: PSSession @@ -643,14 +662,18 @@ Accept wildcard characters: False ``` ### -SessionOption -Specifies advanced options for the session. -Enter a **SessionOption** object, such as one that you create by using the New-PSSessionOption cmdlet, or a hash table in which the keys are session option names and the values are session option values. -The default values for the options are determined by the value of the $PSSessionOption preference variable, if it is set. -Otherwise, the default values are established by options set in the session configuration. +Specifies advanced options for the session. Enter a **SessionOption** object, such as one that you +create by using the New-PSSessionOption cmdlet, or a hash table in which the keys are session option +names and the values are session option values. -The session option values take precedence over default values for sessions set in the $PSSessionOption preference variable and in the session configuration. -However, they do not take precedence over maximum values, quotas or limits set in the session configuration. +The default values for the options are determined by the value of the $PSSessionOption preference +variable, if it is set. Otherwise, the default values are established by options set in the session +configuration. + +The session option values take precedence over default values for sessions set in the +$PSSessionOption preference variable and in the session configuration. However, they do not take +precedence over maximum values, quotas or limits set in the session configuration. For a description of the session options that includes the default values, see New-PSSessionOption. For information about the **$PSSessionOption** preference variable, see [about_Preference_Variables](About/about_Preference_Variables.md). @@ -669,13 +692,15 @@ Accept wildcard characters: False ``` ### -UseSSL -Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to connect to the disconnected session. -By default, SSL is not used. -WS-Management encrypts all Windows PowerShell content transmitted over the network. -*UseSSL* is an additional protection that sends the data across an HTTPS connection instead of an HTTP connection. +Indicates that this cmdlet uses the Secure Sockets Layer (SSL) protocol to connect to the +disconnected session. By default, SSL is not used. + +WS-Management encrypts all Windows PowerShell content transmitted over the network. *UseSSL* is an +additional protection that sends the data across an HTTPS connection instead of an HTTP connection. -If you use this parameter, but SSL is not available on the port that is used for the command, the command fails. +If you use this parameter, but SSL is not available on the port that is used for the command, the +command fails. ```yaml Type: SwitchParameter @@ -706,70 +731,114 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, +-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### System.Management.Automation.Runspaces.PSSession + You can pipe session objects, such as those returned by the Get-PSSession cmdlet, to this cmdlet. ### System.Int32 + You can pipe session IDs to this cmdlet. ### System.Guid + You can pipe the instance IDs of sessions this cmdlet. ### System.String + You can pipe session names to this cmdlet. ## OUTPUTS ### System.Management.Automation.Job or PSObject -This cmdlet returns the results of commands that ran in the disconnected session, if any. -If the value or default value of the *OutTarget* parameter is Job, **Receive-PSSession** returns a job object. -Otherwise, it returns objects that represent that command results. - -## NOTES -* **Receive-PSSession** gets results only from sessions that were disconnected. Only sessions that are connected to, or terminate at, computers that run Windows PowerShell 3.0 or later versions can be disconnected and reconnected. -* If the commands that were running in the disconnected session did not generate results or if the results were already returned to another session, **Receive-PSSession** does not generate any output. -* The output buffering mode of a session determines how commands in the session manage output when the session is disconnected. When the value of the **OutputBufferingMode** option of the session is Drop and the output buffer is full, the command starts to delete output. **Receive-PSSession** cannot recover this output. For more information about the output buffering mode option, see the help topics for the New-PSSessionOption and New-PSTransportOption cmdlets. -* You cannot change the idle time-out value of a **PSSession** when you connect to the **PSSession** or receive results. The *SessionOption* parameter of **Receive-PSSession** takes a **SessionOption** object that has an **IdleTimeout** value. However, the **IdleTimeout** value of the **SessionOption** object and the **IdleTimeout** value of the $PSSessionOption variable are ignored when it connects to a **PSSession** or receiving results. - - You can set and change the idle time-out of a **PSSession** when you create the **PSSession**, by using the New-PSSession or **Invoke-Command** cmdlets, and when you disconnect from the **PSSession**. - The **IdleTimeout** property of a **PSSession** is critical to disconnected sessions, because it determines how long a disconnected session is maintained on the remote computer. -Disconnected sessions are considered to be idle from the moment that they are disconnected, even if commands are running in the disconnected session. +This cmdlet returns the results of commands that ran in the disconnected session, if any. If the +value or default value of the *OutTarget* parameter is Job, **Receive-PSSession** returns a job +object. Otherwise, it returns objects that represent that command results. -* If you start a start a job in a remote session by using the *AsJob* parameter of the **Invoke-Command** cmdlet, the job object is created in the current session, even though the job runs in the remote session. If you disconnect the remote session, the job object in the current session is now disconnected from the job. The job object still contains any results that were returned to it, but it does not receive new results from the job in the disconnected session. - - If a different client connects to the session that contains the running job, the results that were delivered to the original job object in the original session are not available in the newly connected session. -Only results that were not delivered to the original job object are available in the reconnected session. - - Similarly, if you start a script in a session and then disconnect from the session, any results that the script delivers to the session before disconnecting are not available to another client that connects to the session. - - To prevent data loss in sessions that you intend to disconnect, use the *InDisconnectedSession* parameter of the **Invoke-Command** cmdlet. -Because this parameter prevents results from being returned to the current session, all results are available when the session is reconnected. - - You can also prevent data loss by using the **Invoke-Command** cmdlet to run a Start-Job command in the remote session. -In this case, the job object is created in the remote session. -You cannot use the **Receive-PSSession** cmdlet to get the job results. -Instead, use the **Connect-PSSession** cmdlet to connect to the session and then use the **Invoke-Command** cmdlet to run a Receive-Job command in the session. - -* When a session that contains a running job is disconnected and then reconnected, the original job object is reused only if the job is disconnected and reconnected to the same session, and the command to reconnect does not specify a new job name. If the session is reconnected to a different client session or a new job name is specified, Windows PowerShell creates a new job object for the new session. -* When you disconnect a **PSSession**, the session state is Disconnected and the availability is None. - - The value of the **State** property is relative to the current session. -Therefore, a value of Disconnected means that the **PSSession** is not connected to the current session. -However, it does not mean that the **PSSession** is disconnected from all sessions. -It might be connected to a different session. -To determine whether you can connect or reconnect to the session, use the **Availability** property. - - An **Availability** value of None indicates that you can connect to the session. -A value of Busy indicates that you cannot connect to the **PSSession** because it is connected to another session. - - For more information about the values of the **State** property of sessions, see [RunspaceState Enumeration](https://msdn.microsoft.com/library/system.management.automation.runspaces.runspacestate) in the MSDN library. +## NOTES - For more information about the values of the **Availability** property of sessions, see [RunspaceAvailability Enumeration](https://msdn.microsoft.com/library/system.management.automation.runspaces.runspaceavailability) in the MSDN library. +- **Receive-PSSession** gets results only from sessions that were disconnected. Only sessions that + are connected to, or terminate at, computers that run Windows PowerShell 3.0 or later versions can + be disconnected and reconnected. +- If the commands that were running in the disconnected session did not generate results or if the + results were already returned to another session, **Receive-PSSession** does not generate any + output. +- The output buffering mode of a session determines how commands in the session manage output when + the session is disconnected. When the value of the **OutputBufferingMode** option of the session + is Drop and the output buffer is full, the command starts to delete output. **Receive-PSSession** + cannot recover this output. For more information about the output buffering mode option, see the + help topics for the New-PSSessionOption and New-PSTransportOption cmdlets. +- You cannot change the idle time-out value of a **PSSession** when you connect to the **PSSession** + or receive results. The *SessionOption* parameter of **Receive-PSSession** takes a + **SessionOption** object that has an **IdleTimeout** value. However, the **IdleTimeout** value of + the **SessionOption** object and the **IdleTimeout** value of the $PSSessionOption variable are + ignored when it connects to a **PSSession** or receiving results. + + You can set and change the idle time-out of a **PSSession** when you create the **PSSession**, by + using the New-PSSession or **Invoke-Command** cmdlets, and when you disconnect from the + **PSSession**. + + The **IdleTimeout** property of a **PSSession** is critical to disconnected sessions, because it + determines how long a disconnected session is maintained on the remote computer. Disconnected + sessions are considered to be idle from the moment that they are disconnected, even if commands + are running in the disconnected session. + +- If you start a start a job in a remote session by using the *AsJob* parameter of the + **Invoke-Command** cmdlet, the job object is created in the current session, even though the job + runs in the remote session. If you disconnect the remote session, the job object in the current + session is now disconnected from the job. The job object still contains any results that were + returned to it, but it does not receive new results from the job in the disconnected session. + + If a different client connects to the session that contains the running job, the results that were + delivered to the original job object in the original session are not available in the newly + connected session. Only results that were not delivered to the original job object are available + in the reconnected session. + + Similarly, if you start a script in a session and then disconnect from the session, any results + that the script delivers to the session before disconnecting are not available to another client + that connects to the session. + + To prevent data loss in sessions that you intend to disconnect, use the *InDisconnectedSession* + parameter of the **Invoke-Command** cmdlet. Because this parameter prevents results from being + returned to the current session, all results are available when the session is reconnected. + + You can also prevent data loss by using the **Invoke-Command** cmdlet to run a Start-Job command + in the remote session. In this case, the job object is created in the remote session. You cannot + use the **Receive-PSSession** cmdlet to get the job results. Instead, use the + **Connect-PSSession** cmdlet to connect to the session and then use the **Invoke-Command** cmdlet + to run a Receive-Job command in the session. + +- When a session that contains a running job is disconnected and then reconnected, the original job + object is reused only if the job is disconnected and reconnected to the same session, and the + command to reconnect does not specify a new job name. If the session is reconnected to a different + client session or a new job name is specified, Windows PowerShell creates a new job object for the + new session. +- When you disconnect a **PSSession**, the session state is Disconnected and the availability is + None. + + The value of the **State** property is relative to the current session. Therefore, a value of + Disconnected means that the **PSSession** is not connected to the current session. However, it + does not mean that the **PSSession** is disconnected from all sessions. It might be connected to a + different session. To determine whether you can connect or reconnect to the session, use the + **Availability** property. + + An **Availability** value of None indicates that you can connect to the session. A value of Busy + indicates that you cannot connect to the **PSSession** because it is connected to another session. + + For more information about the values of the **State** property of sessions, see + [RunspaceState Enumeration](https://msdn.microsoft.com/library/system.management.automation.runspaces.runspacestate) + in the MSDN library. + + For more information about the values of the **Availability** property of sessions, see + [RunspaceAvailability Enumeration](https://msdn.microsoft.com/library/system.management.automation.runspaces.runspaceavailability) + in the MSDN library. ## RELATED LINKS diff --git a/reference/5.0/Microsoft.PowerShell.Management/Get-WmiObject.md b/reference/5.0/Microsoft.PowerShell.Management/Get-WmiObject.md index 6b7fb1353d41..b0b2351c7b4f 100644 --- a/reference/5.0/Microsoft.PowerShell.Management/Get-WmiObject.md +++ b/reference/5.0/Microsoft.PowerShell.Management/Get-WmiObject.md @@ -7,10 +7,11 @@ online version: http://go.microsoft.com/fwlink/?LinkId=821595 external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml title: Get-WmiObject --- + # Get-WmiObject ## SYNOPSIS -Gets instances of WMI classes or information about the available classes. +Gets instances of Windows Management Instrumentation (WMI) classes or information about the available classes. ## SYNTAX @@ -59,15 +60,15 @@ Get-WmiObject [-Amended] [-AsJob] [-Impersonation ] [-Authen ## DESCRIPTION -Starting in Windows PowerShell 3.0, this cmdlet has been superseded by Get-CimInstancehttp://technet.microsoft.com/library/jj590758(v=wps.630).aspx. +Starting in PowerShell 3.0, this cmdlet has been superseded by `Get-CimInstance`. -The **Get-WmiObject** cmdlet gets instances of Windows Management Instrumentation (WMI) classes or information about the available WMI classes. -To specify a remote computer, use the *ComputerName* parameter. -If the *List* parameter is specified, the cmdlet gets information about the WMI classes that are available in a specified namespace. -If the *Query* parameter is specified, the cmdlet runs a WMI query language (WQL) statement. +The **Get-WmiObject** cmdlet gets instances of WMI classes or information about the available WMI classes. +To specify a remote computer, use the **ComputerName** parameter. +If the **List** parameter is specified, the cmdlet gets information about the WMI classes that are available in a specified namespace. +If the **Query** parameter is specified, the cmdlet runs a WMI query language (WQL) statement. -This cmdlet does not use Windows PowerShell remoting to perform remote operations. -You can use the *ComputerName* parameter of the **Get-WmiObject** cmdlet even if your computer does not meet the requirements for Windows PowerShellremoting or is not configured for remoting in Windows PowerShell. +The **Get-WmiObject** cmdlet does not use Windows PowerShell remoting to perform remote operations. +You can use the **ComputerName** parameter of the **Get-WmiObject** cmdlet even if your computer does not meet the requirements for Windows PowerShell remoting or is not configured for remoting in Windows PowerShell. Beginning in Windows PowerShell 3.0, the **__Server** property of the object that **Get-WmiObject** returns has a **PSComputerName** alias. This makes it easier to include the source computer name in output and reports. @@ -104,6 +105,7 @@ This command gets the WMI classes in the root or default namespace of the local ``` PS C:\> Get-WmiObject -Query "select * from win32_service where name='WinRM'" -ComputerName Server01, Server02 | Format-List -Property PSComputerName, Name, ExitCode, Name, ProcessID, StartMode, State, Status + PSComputerName : SERVER01 Name : WinRM ExitCode : 0 @@ -123,7 +125,7 @@ State : Running Status : OK ``` -This command gets the WinRM service on the computers that are specified by the value of the *ComputerName* parameter. +This command gets the WinRM service on the computers that are specified by the value of the **ComputerName** parameter. A pipeline operator (|) sends the output to the Format-List cmdlet, which adds the **PSComputerName** property to the default output. This makes it easy to see the computer on which the service resides. @@ -147,6 +149,7 @@ This command is an alternative to using the Stop-Service cmdlet. ``` PS C:\> Get-WmiObject -Class Win32_Bios | Format-List -Property + Status : OK Name : Phoenix ROM BIOS PLUS Version 1.10 A05 Caption : Phoenix ROM BIOS PLUS Version 1.10 A05 @@ -155,13 +158,13 @@ __GENUS : 2 __CLASS : Win32_BIOS __SUPERCLASS : CIM_BIOSElement __DYNASTY : CIM_ManagedSystemElement -__RELPATH : Win32_BIOS.Name="Phoenix ROM BIOS PLUS Version 1.10 … +__RELPATH : Win32_BIOS.Name="Phoenix ROM BIOS PLUS Version 1.10 __PROPERTY_COUNT : 27 -__DERIVATION : {CIM_BIOSElement, CIM_SoftwareElement, CIM_LogicalElement,… +__DERIVATION : {CIM_BIOSElement, CIM_SoftwareElement, CIM_LogicalElement, __SERVER : Server01 __NAMESPACE : root\cimv2 __PATH : \\SERVER01\root\cimv2:Win32_BIOS.Name="Phoenix ROM BIOS - BiosCharacteristics : {7, 9, 10, 11...} +BiosCharacteristics : {7, 9, 10, 11...} BIOSVersion : {DELL - 15, Phoenix ROM BIOS PLUS Version 1.10 A05} BuildNumber : CodeSet : @@ -179,13 +182,14 @@ ReleaseDate : 20101103000000.000000+000 SerialNumber : 8VDM9P1 SMBIOSBIOSVersion : A05 SMBIOSMajorVersion : 2 -SMBIOSMinorVersion : 6SoftwareElementID : Phoenix ROM BIOS PLUS Version 1.10 A05 +SMBIOSMinorVersion : 6 +SoftwareElementID : Phoenix ROM BIOS PLUS Version 1.10 A05 SoftwareElementState : 3 TargetOperatingSystem : 0 Version : DELL - 15 Scope : System.Management.ManagementScope Path : \\SERVER01\root\cimv2:Win32_BIOS.Name="Phoenix ROM BIOS - Options : System.Management.ObjectGetOptions +Options : System.Management.ObjectGetOptions ClassPath : \\JUNE-PC\root\cimv2:Win32_BIOS Properties : {BiosCharacteristics, BIOSVersion, BuildNumber, Caption...} SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...} @@ -204,15 +208,14 @@ By default, only a subset (defined in the Types.ps1xml configuration file) are d PS C:\> Get-WmiObject Win32_Service -Credential FABRIKAM\administrator -Computer Fabrikam ``` -This command uses the *Credential* parameter of the **Get-WmiObject** cmdlet to get the services on a remote computer. -The value of the *Credential* parameter is a user account name. +This command uses the **Credential** parameter of the **Get-WmiObject** cmdlet to get the services on a remote computer. +The value of the **Credential** parameter is a user account name. The user is prompted for a password. ## PARAMETERS ### -Amended - -Indicates whether the objects that are returned from WMI should contain amended information. +Gets or sets a value that indicates whether the objects that are returned from WMI should contain amended information. Typically, amended information is localizable information, such as object and property descriptions, that is attached to the WMI object. ```yaml @@ -228,21 +231,20 @@ Accept wildcard characters: False ``` ### -AsJob - -Indicates that this cmdlet runs the command as a background job. +Runs the command as a background job. Use this parameter to run commands that take a long time to finish. -When you use the *AsJob* parameter, the command returns an object that represents the background job and then displays the command prompt. +When you use the **AsJob** parameter, the command returns an object that represents the background job and then displays the command prompt. You can continue to work in the session while the job finishes. If **Get-WmiObject** is used on a remote computer, the job is created on the local computer, and the results from remote computers are automatically returned to the local computer. To manage the job, use the cmdlets that contain the Job cmdlets. To get the job results, use the Receive-Job cmdlet. -To use this parameter with remote computers, the local and remote computers must be configured for remoting. -Additionally, you must start Windows PowerShell by using the Run as administrator option in Windows Vista and later versions of Windows. +Note: To use this parameter with remote computers, the local and remote computers must be configured for remoting. +Additionally, you must start Windows PowerShell by using the "Run as administrator" option in Windows Vista and later versions of Windows. For more information, see about_Remote_Requirements. -For more information about Windows PowerShellbackground jobs, see about_Jobs and about_Remote_Jobs. +For more information about Windows PowerShell background jobs, see about_Jobs and about_Remote_Jobs. ```yaml Type: SwitchParameter @@ -259,23 +261,16 @@ Accept wildcard characters: False ### -Authentication Specifies the authentication level to be used with the WMI connection. -The acceptable values for this parameter are: - --1: Unchanged +Valid values are: -0: Default - -1: None (No authentication in performed.) - -2: Connect (Authentication is performed only when the client establishes a relationship with the application.) - -3: Call (Authentication is performed only at the beginning of each call when the application receives the request.) - -4: Packet (Authentication is performed on all the data that is received from the client.) - -5: PacketIntegrity (All the data that is transferred between the client and the application is authenticated and verified.) - -6: PacketPrivacy (The properties of the other authentication levels are used, and all the data is encrypted.) +- -1: Unchanged +- 0: Default +- 1: None (No authentication in performed.) +- 2: Connect (Authentication is performed only when the client establishes a relationship with the application.) +- 3: Call (Authentication is performed only at the beginning of each call when the application receives the request.) +- 4: Packet (Authentication is performed on all the data that is received from the client.) +- 5: PacketIntegrity (All the data that is transferred between the client and the application is authenticated and verified.) +- 6: PacketPrivacy (The properties of the other authentication levels are used, and all the data is encrypted.) ```yaml Type: AuthenticationLevel @@ -349,7 +344,7 @@ The default is the local computer. To specify the local computer, such as in a list of computer names, use "localhost", the local computer name, or a dot (.). This parameter does not rely on Windows PowerShell remoting, which uses WS-Management. -You can use the *ComputerName* parameter of **Get-WmiObject** even if your computer is not configured to run WS-Management remote commands. +You can use the **ComputerName** parameter of **Get-WmiObject** even if your computer is not configured to run WS-Management remote commands. ```yaml Type: String[] @@ -367,7 +362,7 @@ Accept wildcard characters: False Specifies a user account that has permission to perform this action. The default is the current user. -Type a user name, such as User01, Domain01\User01, or User@Contoso.com. +Type a user name, such as "User01", "Domain01\User01", or User@Contoso.com. Or, enter a **PSCredential** object, such as an object that is returned by the Get-Credential cmdlet. When you type a user name, you are prompted for a password. @@ -401,7 +396,7 @@ Accept wildcard characters: False ### -EnableAllPrivileges -Indicates that this cmdlet enables all the privileges of the current user before the command makes the WMI call. +Enables all the privileges of the current user before the command makes the WMI call. ```yaml Type: SwitchParameter @@ -445,19 +440,15 @@ Specifies the impersonation level to use. The acceptable values for this parameter are: -0: Default. +- 0: Default. Reads the local registry for the default impersonation level , which is usually set to "3: Impersonate". - -1: Anonymous. +- 1: Anonymous. Hides the credentials of the caller. - -2: Identify. +- 2: Identify. Allows objects to query the credentials of the caller. - -3: Impersonate. +- 3: Impersonate. Allows objects to use the credentials of the caller. - -4: Delegate. +- 4: Delegate. Allows objects to permit other objects to use the credentials of the caller. ```yaml @@ -474,11 +465,10 @@ Accept wildcard characters: False ``` ### -List +Gets the names of the WMI classes in the WMI repository namespace that is specified by the **Namespace** parameter. -Gets the names of the WMI classes in the WMI repository namespace that is specified by the *Namespace* parameter. - -If you specify the *List* parameter, but not the *Namespace* parameter, **Get-WmiObject** uses the Root\Cimv2 namespace by default. -This cmdlet does not use the **Default Namespace** registry entry in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WBEM\Scripting registry key to determine the default namespace. +If you specify the **List** parameter, but not the **Namespace** parameter, **Get-WmiObject** uses the Root\Cimv2 namespace by default. +This cmdlet does not use the **Default Namespace** registry entry in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WBEM\Scripting registry key to determine the default namespace. ```yaml Type: SwitchParameter @@ -511,8 +501,8 @@ Accept wildcard characters: False ### -Namespace -Specifies the WMI repository namespace where the specified WMI class is located when used with the *Class* parameter. -When used with the *List* parameter, it specifies the namespace from which to gather WMI class information. +When used with the **Class** parameter, the **Namespace** parameter specifies the WMI repository namespace where the specified WMI class is located. +When used with the **List** parameter, it specifies the namespace from which to gather WMI class information. ```yaml Type: String @@ -545,7 +535,7 @@ Accept wildcard characters: False ### -Query -Specifies WMI Query Language (WQL) statement that this cmdlet runs. +Runs the specified WMI Query Language (WQL) statement. This parameter does not support event queries. ```yaml @@ -562,7 +552,7 @@ Accept wildcard characters: False ### -Recurse -Indicates that this cmdlet searches the current namespace and all other namespaces for the class name that is specified by the *Class* parameter. +Searches the current namespace and all other namespaces for the class name that is specified by the **Class** parameter. ```yaml Type: SwitchParameter @@ -579,7 +569,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of WMI operations that can be executed simultaneously. -This parameter is valid only when the *AsJob* parameter is used in the command. +This parameter is valid only when the **AsJob** parameter is used in the command. ```yaml Type: Int32 @@ -601,14 +591,14 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### None -You cannot pipe input to this cmdlet. +You cannot pipe input to **Get-WmiObject**. ## OUTPUTS ### PSObject or System.Management.Automation.RemotingJob -When you use the *AsJob* parameter, the cmdlet returns a job object. -Otherwise, the object that **Get-WmiObject** returns depends on the value of the *Class* parameter. +When you use the **AsJob** parameter, the cmdlet returns a job object. +Otherwise, the object that **Get-WmiObject** returns depends on the value of the **Class** parameter. ## NOTES @@ -616,10 +606,16 @@ Otherwise, the object that **Get-WmiObject** returns depends on the value of the Only some of the properties of each WMI class are displayed by default. The set of properties that is displayed for each WMI class is specified in the Types.ps1xml configuration file. -To get all properties of a WMI object, use the Get-Member or Format-List cmdlets. +To get all properties of a WMI object, use the Get-Member or Format-List cmdlets. ## RELATED LINKS +[Invoke-WmiMethod](Invoke-WmiMethod.md) + +[Remove-WmiObject](Remove-WmiObject.md) + +[Set-WmiInstance](Set-WmiInstance.md) + [Get-WSManInstance](../Microsoft.WsMan.Management/Get-WSManInstance.md) [Invoke-WSManAction](../Microsoft.WsMan.Management/Invoke-WSManAction.md) @@ -627,9 +623,3 @@ To get all properties of a WMI object, use the Get-Member or Format-List cmdlets [New-WSManInstance](../Microsoft.WsMan.Management/New-WSManInstance.md) [Remove-WSManInstance](../Microsoft.WsMan.Management/Remove-WSManInstance.md) - -[Invoke-WmiMethod](Invoke-WmiMethod.md) - -[Remove-WmiObject](Remove-WmiObject.md) - -[Set-WmiInstance](Set-WmiInstance.md) \ No newline at end of file diff --git a/reference/5.0/Microsoft.PowerShell.Security/Get-CmsMessage.md b/reference/5.0/Microsoft.PowerShell.Security/Get-CmsMessage.md index 9973f35db125..97bb9bcf9f14 100644 --- a/reference/5.0/Microsoft.PowerShell.Security/Get-CmsMessage.md +++ b/reference/5.0/Microsoft.PowerShell.Security/Get-CmsMessage.md @@ -73,7 +73,7 @@ This command gets encrypted content located at C:\Users\Test\Documents\PowerShel ``` PS C:\> $Msg = Get-CmsMessage -Path "C:\Users\Test\Documents\PowerShell ISE\Future_Plans.txt" -$Msg | Unprotect-CmsMessage -To "‎cn=youralias@emailaddress.com" +$Msg | Unprotect-CmsMessage -To "cn=youralias@emailaddress.com" Try the new Break All command ``` diff --git a/reference/5.0/Microsoft.PowerShell.Security/Set-Acl.md b/reference/5.0/Microsoft.PowerShell.Security/Set-Acl.md index 5b733b2ed4f2..80230afb1c46 100644 --- a/reference/5.0/Microsoft.PowerShell.Security/Set-Acl.md +++ b/reference/5.0/Microsoft.PowerShell.Security/Set-Acl.md @@ -10,6 +10,7 @@ title: Set-Acl # Set-Acl ## SYNOPSIS + Changes the security descriptor of a specified item, such as a file or a registry key. ## SYNTAX @@ -50,9 +51,9 @@ It uses the value of the **AclObject** parameter as a model and changes the valu ### Example 1: Copy a security descriptor from one file to another -``` -PS C:\> $DogACL = Get-Acl -Path "C:\Dog.txt" -PS C:\> Set-Acl -Path "C:\Cat.txt" -AclObject $DogACL +```powershell +$DogACL = Get-Acl -Path "C:\Dog.txt" +Set-Acl -Path "C:\Cat.txt" -AclObject $DogACL ``` These commands copy the values from the security descriptor of the Dog.txt file to the security descriptor of the Cat.txt file. @@ -68,8 +69,8 @@ The value of the **AclObject** parameter is the model ACL, in this case, the ACL ### Example 2: Use the pipeline operator to pass a descriptor -``` -PS C:\> Get-Acl -Path "C:\Dog.txt" | Set-Acl -Path "C:\Cat.txt" +```powershell +Get-Acl -Path "C:\Dog.txt" | Set-Acl -Path "C:\Cat.txt" ``` This command is almost the same as the command in the previous example, except that it uses a pipeline operator to send the security descriptor from a Get-Aclcommand to a `Set-Acl` command. @@ -82,9 +83,9 @@ When the command completes, the ACLs of the Dog.txt and Cat.txt files are identi ### Example 3: Apply a security descriptor to multiple files -``` -PS C:\> $NewAcl = Get-Acl File0.txt -PS C:\> Get-ChildItem -Path "C:\temp" -Recurse -Include "*.txt" -Force | Set-Acl -AclObject $NewAcl +```powershell +$NewAcl = Get-Acl File0.txt +Get-ChildItem -Path "C:\temp" -Recurse -Include "*.txt" -Force | Set-Acl -AclObject $NewAcl ``` These commands apply the security descriptors in the File0.txt file to all text files in the C:\Temp directory and all of its subdirectories. @@ -131,7 +132,7 @@ Establishes or changes the central access policy of the item. Enter the CAP ID or friendly name of a central access policy on the computer. Beginning in Windows Server 2012, administrators can use Active Directory and Group Policy to set central access policies for users and groups. -For more information, see [Dynamic Access Control: Scenario Overview](http://go.microsoft.com/fwlink/?LinkId=238408). +For more information, see [Dynamic Access Control: Scenario Overview](/windows-server/identity/solution-guides/dynamic-access-control--scenario-overview). This parameter was introduced in Windows PowerShell 3.0. @@ -151,8 +152,8 @@ Accept wildcard characters: False Removes the central access policy from the specified item. -Beginning in Windows Server® 2012, administrators can use Active Directory and Group Policy to set central access policies for users and groups. -For more information, see [Dynamic Access Control: Scenario Overview](http://go.microsoft.com/fwlink/?LinkId=238408). +Beginning in Windows Server 2012, administrators can use Active Directory and Group Policy to set central access policies for users and groups. +For more information, see [Dynamic Access Control: Scenario Overview](/windows-server/identity/solution-guides/dynamic-access-control--scenario-overview). This parameter was introduced in Windows PowerShell 3.0. @@ -163,7 +164,7 @@ Aliases: Required: False Position: Named -Default value: None +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/reference/5.0/Microsoft.PowerShell.Utility/Convert-String.md b/reference/5.0/Microsoft.PowerShell.Utility/Convert-String.md index 307cfdebdcf2..09c79a040f18 100644 --- a/reference/5.0/Microsoft.PowerShell.Utility/Convert-String.md +++ b/reference/5.0/Microsoft.PowerShell.Utility/Convert-String.md @@ -46,14 +46,14 @@ It puts the surname first in the output, followed by an initial. ### Example 2: Simplify format of a string ```powershell -$composers = @("Johann Sebastian Bach", "Wolfgang Amadeus Mozart", "Frédéric François Chopin", "Johannes Brahms") +$composers = @("Johann Sebastian Bach", "Wolfgang Amadeus Mozart", "Frederic Francois Chopin", "Johannes Brahms") $composers | Convert-String -Example "first middle last=last, first" ``` ```output Bach, Johann Mozart, Wolfgang -Chopin, Frédéric +Chopin, Frederic Brahms, Johannes ``` @@ -67,14 +67,14 @@ All middle names removed; entry without middle name is handled correctly. ### Example 3: Output management when strings don't match example ```powershell -$composers = @("Johann Sebastian Bach", "Wolfgang Amadeus Mozart", "Frédéric François Chopin", "Johannes Brahms") +$composers = @("Johann Sebastian Bach", "Wolfgang Amadeus Mozart", "Frederic Francois Chopin", "Johannes Brahms") $composers | Convert-String -Example "first middle last=middle, first" ``` ```output Sebastian, Johann Amadeus, Wolfgang -François, Frédéric +Francois, Frederic ``` The first command creates an array that contains first, middle and last names. diff --git a/reference/5.0/Microsoft.PowerShell.Utility/Get-Alias.md b/reference/5.0/Microsoft.PowerShell.Utility/Get-Alias.md index 89b48554a60b..8664022ad989 100644 --- a/reference/5.0/Microsoft.PowerShell.Utility/Get-Alias.md +++ b/reference/5.0/Microsoft.PowerShell.Utility/Get-Alias.md @@ -10,6 +10,7 @@ title: Get-Alias # Get-Alias ## SYNOPSIS + Gets the aliases for the current session. ## SYNTAX @@ -36,7 +37,7 @@ This includes built-in aliases, aliases that you have set or imported, and alias By default, **Get-Alias** takes an alias and returns the command name. When you use the *Definition* parameter, **Get-Alias** takes a command name and returns its aliases. -Beginning in Windows PowerShell 3.0, **Get-Alias** displays non-hyphenated alias names in an \ -\> \ format to make it even easier to find the information that you need. +Beginning in Windows PowerShell 3.0, **Get-Alias** displays non-hyphenated alias names in an ` -> ` format to make it even easier to find the information that you need. ## EXAMPLES @@ -44,34 +45,25 @@ Beginning in Windows PowerShell 3.0, **Get-Alias** displays non-hyphenated alias ``` PS C:\> Get-Alias -CommandType Name +CommandType Name ----------- ---- - Alias % -> ForEach-Object - Alias ? -> Where-Object - Alias ac -> Add-Content - Alias asnp -> Add-PSSnapin - Alias cat -> Get-Content - Alias cd -> Set-Location - Alias chdir -> Set-Location - Alias clc -> Clear-Content - Alias clear -> Clear-Host - -Alias clhy -> Clear-History … +Alias clhy -> Clear-History +... ``` This command gets all aliases in the current session. -The output shows the \ -\> \ format that was introduced in Windows PowerShell 3.0. +The output shows the ` -> ` format that was introduced in Windows PowerShell 3.0. This format is used only for aliases that do not include hyphens, because aliases with hyphens are typically preferred names for cmdlets and functions, rather than nicknames. ### Example 2: Get aliases by name @@ -84,8 +76,8 @@ This command gets all aliases that begin with gp or sp, except for aliases that ### Example 3: Get aliases for a cmdlet -``` -PS C:\> Get-Alias -Definition Get-ChildItem +```powershell +Get-Alias -Definition Get-ChildItem ``` This command gets the aliases for the Get-ChildItem cmdlet. @@ -95,8 +87,8 @@ The *Definition* parameter gets the alias when you know the item name. ### Example 4: Get aliases by property -``` -PS C:\> Get-Alias | Where-Object {$_.Options -Match "ReadOnly"} +```powershell +Get-Alias | Where-Object {$_.Options -Match "ReadOnly"} ``` This command gets all aliases in which the value of the Options property is ReadOnly. @@ -107,11 +99,11 @@ To find all properties and methods of AliasInfo objects, type `Get-Alias | get-m ### Example 5: Get aliases by name and filter by beginning letter -``` -PS C:\> Get-Alias -Definition "*-PSSession" -Exclude e* -Scope Global +```powershell +Get-Alias -Definition "*-PSSession" -Exclude e* -Scope Global ``` -This example gets aliases for commands that have names that end in -PSSession, except for those that begin with e. +This example gets aliases for commands that have names that end in "-PSSession", except for those that begin with "e". The command uses the *Scope* parameter to apply the command in the global scope. This is useful in scripts when you want to get the aliases in the session. @@ -120,7 +112,7 @@ This is useful in scripts when you want to get the aliases in the session. ### -Definition -Specifies an array of aliases for the specified item. +Gets the aliases for the specified item. Enter the name of a cmdlet, function, script, file, or executable file. This parameter is called *Definition*, because it searches for the item name in the Definition property of the alias object. @@ -134,14 +126,14 @@ Required: False Position: Named Default value: None Accept pipeline input: False -Accept wildcard characters: False +Accept wildcard characters: True ``` ### -Exclude -Specifies an array of items that this cmdlet omits. -The value of this parameter qualifies the *Name* and *Definition* parameters. -Enter a name, a definition, or a pattern, such as s*. +Omits the specified items. +The value of this parameter qualifies the Name and Definition parameters. +Enter a name, a definition, or a pattern, such as "s*". Wildcards are permitted. ```yaml @@ -153,7 +145,7 @@ Required: False Position: Named Default value: None Accept pipeline input: False -Accept wildcard characters: False +Accept wildcard characters: True ``` ### -Name @@ -196,7 +188,7 @@ Aliases: Required: False Position: Named -Default value: None +Default value: Local Accept pipeline input: False Accept wildcard characters: False ``` @@ -220,13 +212,11 @@ You can pipe alias names to **Get-Alias**. ## NOTES -* To create a new alias, use Set-Alias or New-Alias. To delete an alias, use Remove-Item. -* The arrow-based alias name format is not used for aliases that include a hyphen. These are likely to be preferred substitute names for cmdlets and functions, instead of typical abbreviations or nicknames. +- To create a new alias, use Set-Alias or New-Alias. To delete an alias, use Remove-Item. +- The arrow-based alias name format is not used for aliases that include a hyphen. These are likely to be preferred substitute names for cmdlets and functions, instead of typical abbreviations or nicknames. ## RELATED LINKS -[About Aliases](../Microsoft.PowerShell.Core/About/about_Aliases.md) - [Export-Alias](Export-Alias.md) [Import-Alias](Import-Alias.md) @@ -235,4 +225,6 @@ You can pipe alias names to **Get-Alias**. [Set-Alias](Set-Alias.md) -[Alias Provider](../Microsoft.PowerShell.Core/Providers/Alias-Provider.md) \ No newline at end of file +[Alias Provider](../Microsoft.PowerShell.Core/Providers/Alias-Provider.md) + +[about_Aliases](../Microsoft.PowerShell.Core/About/about_Aliases.md) \ No newline at end of file diff --git a/reference/5.0/Microsoft.PowerShell.Utility/Select-Object.md b/reference/5.0/Microsoft.PowerShell.Utility/Select-Object.md index f68f7996c29b..b6fdbe26137c 100644 --- a/reference/5.0/Microsoft.PowerShell.Utility/Select-Object.md +++ b/reference/5.0/Microsoft.PowerShell.Utility/Select-Object.md @@ -10,6 +10,7 @@ title: Select-Object # Select-Object ## SYNOPSIS + Selects objects or object properties. ## SYNTAX @@ -78,7 +79,7 @@ InternalName: explorer OriginalFilename: EXPLORER.EXE.MUI FileVersion: 10.0.17134.1 (WinBuild.160101.0800) FileDescription: Windows Explorer -Product: Microsoft� Windows� Operating System +Product: Microsoft Windows Operating System ProductVersion: 10.0.17134.1 ... ``` @@ -313,7 +314,7 @@ Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/reference/5.0/PSDesiredStateConfiguration/About/about_Classes_and_DSC.md b/reference/5.0/PSDesiredStateConfiguration/About/about_Classes_and_DSC.md index 77178fe29bc2..80d169879d49 100644 --- a/reference/5.0/PSDesiredStateConfiguration/About/about_Classes_and_DSC.md +++ b/reference/5.0/PSDesiredStateConfiguration/About/about_Classes_and_DSC.md @@ -220,12 +220,12 @@ class FileResource [System.IO.FileInfo] $destFileInfo = new-object System.IO.FileInfo($this.Path) - + if (-not $destFileInfo.Directory.Exists) { $FullName = $destFileInfo.Directory.FullName $Message = "Creating directory $FullName" - + Write-Verbose -Message $Message #use CreateDirectory instead of New-Item to avoid code @@ -362,14 +362,14 @@ class FileResource{ throw "SourcePath '$this.SourcePath' is not found." } - [System.IO.FileInfo] + [System.IO.FileInfo] $destFileInfo = new-object System.IO.FileInfo($this.Path) - + if (-not $destFileInfo.Directory.Exists) { - $FullName = $destFileInfo.Directory.FullName + $FullName = $destFileInfo.Directory.FullName $Message = "Creating directory $FullName" - + Write-Verbose -Message $Message #use CreateDirectory instead of New-Item to avoid lines @@ -669,7 +669,7 @@ enum OtherEnum { Max = [SomeEnum]::Max + 1 } The `hidden` keyword, introduced in Windows PowerShell 5.0, hides class members from default `Get-Member` results. Specify the hidden property as shown in the following line: - + ```powershell hidden [type] $classmember = ``` @@ -686,7 +686,7 @@ For more information, see ### Import-DscResource `Import-DscResource` is now a true dynamic keyword. PowerShell parses the -specified module’s root module, searching for classes that contain the +specified module's root module, searching for classes that contain the DscResource attribute. ### Properties @@ -735,10 +735,10 @@ The following are ways of instantiating classes: `$a = [MyClass]::new()` - Calling a constructor with a parameter. - + `$b = [MyClass]::new(42)` -- Passing an array to a constructor with multiple parameters +- Passing an array to a constructor with multiple parameters `$c = [MyClass]::new(@(42,43,44), "Hello")` @@ -900,7 +900,7 @@ class Element # # Helper functions for creating specific element types on top of the classes. -# These are required because types aren’t visible outside of the module. +# These are required because types aren't visible outside of the module. # function H1 {[Element] @{Tag = "H1"; Text = $args.foreach{$_} -join " "}} function H2 {[Element] @{Tag = "H2"; Text = $args.foreach{$_} -join " "}} diff --git a/reference/5.0/PSDesiredStateConfiguration/Disable-DscDebug.md b/reference/5.0/PSDesiredStateConfiguration/Disable-DscDebug.md index ba77e67534fe..e45283cbcb5e 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Disable-DscDebug.md +++ b/reference/5.0/PSDesiredStateConfiguration/Disable-DscDebug.md @@ -102,7 +102,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Enable-DscDebug.md b/reference/5.0/PSDesiredStateConfiguration/Enable-DscDebug.md index 2433eb02b900..e87fc3851cd4 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Enable-DscDebug.md +++ b/reference/5.0/PSDesiredStateConfiguration/Enable-DscDebug.md @@ -118,7 +118,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Get-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Get-DscConfiguration.md index 56875c9f546b..06e604fd570f 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Get-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Get-DscConfiguration.md @@ -96,7 +96,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Get-DscConfigurationStatus.md b/reference/5.0/PSDesiredStateConfiguration/Get-DscConfigurationStatus.md index 4770665d9526..e25e825ebb66 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Get-DscConfigurationStatus.md +++ b/reference/5.0/PSDesiredStateConfiguration/Get-DscConfigurationStatus.md @@ -111,7 +111,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Get-DscLocalConfigurationManager.md b/reference/5.0/PSDesiredStateConfiguration/Get-DscLocalConfigurationManager.md index 835be59e9468..452b9a0a808b 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Get-DscLocalConfigurationManager.md +++ b/reference/5.0/PSDesiredStateConfiguration/Get-DscLocalConfigurationManager.md @@ -97,7 +97,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Publish-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Publish-DscConfiguration.md index 9f6b82e03b6a..cc3f9030980a 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Publish-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Publish-DscConfiguration.md @@ -144,7 +144,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.md b/reference/5.0/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.md index 6f6a3bd1bbcc..bd46e12c34e9 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.md +++ b/reference/5.0/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.md @@ -144,7 +144,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Restore-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Restore-DscConfiguration.md index 2d690820c8b3..c95a7a4bbca4 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Restore-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Restore-DscConfiguration.md @@ -115,7 +115,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Set-DscLocalConfigurationManager.md b/reference/5.0/PSDesiredStateConfiguration/Set-DscLocalConfigurationManager.md index e157fb1687d5..efcc03dccfe7 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Set-DscLocalConfigurationManager.md +++ b/reference/5.0/PSDesiredStateConfiguration/Set-DscLocalConfigurationManager.md @@ -147,7 +147,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Start-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Start-DscConfiguration.md index ef98cdb28af5..aee4152fe143 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Start-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Start-DscConfiguration.md @@ -214,7 +214,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Stop-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Stop-DscConfiguration.md index 2d373a0e0b27..180856a5981c 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Stop-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Stop-DscConfiguration.md @@ -122,7 +122,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Test-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Test-DscConfiguration.md index 970b92b01e32..6403685bc0a4 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Test-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Test-DscConfiguration.md @@ -234,7 +234,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSDesiredStateConfiguration/Update-DscConfiguration.md b/reference/5.0/PSDesiredStateConfiguration/Update-DscConfiguration.md index aa1689511ea6..e90b1b4024dc 100644 --- a/reference/5.0/PSDesiredStateConfiguration/Update-DscConfiguration.md +++ b/reference/5.0/PSDesiredStateConfiguration/Update-DscConfiguration.md @@ -138,7 +138,7 @@ Accept wildcard characters: False ### -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. -If this parameter is omitted or a value of `0` is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. +If this parameter is omitted or a value of `0` is entered, then Windows PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. ```yaml diff --git a/reference/5.0/PSReadline/Get-PSReadlineOption.md b/reference/5.0/PSReadline/Get-PSReadlineOption.md index 29913a35961e..fce75a519d58 100644 --- a/reference/5.0/PSReadline/Get-PSReadlineOption.md +++ b/reference/5.0/PSReadline/Get-PSReadlineOption.md @@ -51,7 +51,7 @@ HistorySearchCursorMovesToEnd : False ShowToolTips : False DingTone : 1221 CompletionQueryItems : 100 -WordDelimiters : ;:,.[]{}()/\|^&*-=+'"–—― +WordDelimiters : ;:,.[]{}()/\|^&*-=+'" DingDuration : 50 BellStyle : Audible HistorySearchCaseSensitive : False diff --git a/reference/5.0/PSReadline/Set-PSReadlineOption.md b/reference/5.0/PSReadline/Set-PSReadlineOption.md index 0b1616137dfb..9b26af012b13 100644 --- a/reference/5.0/PSReadline/Set-PSReadlineOption.md +++ b/reference/5.0/PSReadline/Set-PSReadlineOption.md @@ -655,7 +655,7 @@ Aliases: Required: False Position: Named -Default value: ;:,.[]{}()/\|^&*-=+'"–—― +Default value: ;:,.[]{}()/\|^&*-=+'" Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/reference/5.0/PSWorkflow/About/about_ActivityCommonParameters.md b/reference/5.0/PSWorkflow/About/about_ActivityCommonParameters.md index 970df1999f91..4d82b4ef6407 100644 --- a/reference/5.0/PSWorkflow/About/about_ActivityCommonParameters.md +++ b/reference/5.0/PSWorkflow/About/about_ActivityCommonParameters.md @@ -5,45 +5,36 @@ locale: en-us keywords: powershell,cmdlet title: about_ActivityCommonParameters --- - # About ActivityCommonParameters -# SHORT DESCRIPTION - -Describes the parameters that Windows PowerShell -Workflow adds to activities. +## SHORT DESCRIPTION -# LONG DESCRIPTION +Describes the parameters that Windows PowerShell Workflow adds to activities. -Windows PowerShell Workflow adds the activity common -parameters to activities that are derived from the -PSActivity base class. This category includes the -InlineScript activity and Windows PowerShell cmdlets -that are implemented as activities, such as Get-Process -and Get-WinEvent. +## LONG DESCRIPTION -The activity common parameters are not valid on the -Suspend-Workflow and Checkpoint-Workflow activities -and they are not added to cmdlets or expressions that -Windows PowerShell Workflow automatically runs in an -InlineScript script block or similar activity. The -activity common parameters are available on the -InlineScript activity, but not on commands in the -InlineScript script block. +Windows PowerShell Workflow adds the activity common parameters to activities +that are derived from the PSActivity base class. This category includes the +InlineScript activity and Windows PowerShell cmdlets that are implemented as +activities, such as Get-Process and Get-WinEvent. -Several of the activity common parameters are also -workflow common parameters or Windows PowerShell -common parameters. Other activity common parameters -are unique to activities. +The activity common parameters are not valid on the Suspend-Workflow and +Checkpoint-Workflow activities and they are not added to cmdlets or expressions +that Windows PowerShell Workflow automatically runs in an InlineScript script +block or similar activity. The activity common parameters are available on the +InlineScript activity, but not on commands in the InlineScript script block. -For information about the workflow common parameters, -see about_WorkflowCommonParameters. For information -about the Windows PowerShell common parameters, see -about_CommonParameters. +Several of the activity common parameters are also workflow common parameters +or Windows PowerShell common parameters. Other activity common parameters are +unique to activities. -# LIST OF ACTIVITY COMMON PARAMETERS +For information about the workflow common parameters, see +about_WorkflowCommonParameters. For information about the Windows PowerShell +common parameters, see about_CommonParameters. +### LIST OF ACTIVITY COMMON PARAMETERS +``` AppendOutput PSDebug Debug PSDisableSerialization DisplayName PSDisableSerializationPreference @@ -62,590 +53,567 @@ PSConnectionRetryCount Result PSConnectionRetryIntervalSec UseDefaultInput PSConnectionURI Verbose PSCredential WarningAction +``` -# PARAMETER DESCRIPTIONS +### PARAMETER DESCRIPTIONS This section describes the activity common parameters. --AppendOutput -A value of $True adds the output of the activity to the value of -the variable. A value of $False has no effect. By default, assigning -a value to a variable replaces the variable value. +#### AppendOutput \ -For example, the following commands add a process object to the -service object in the $x variable. +A value of `$True` adds the output of the activity to the value of the variable. +A value of `$False` has no effect. By default, assigning a value to a variable +replaces the variable value. -workflow Test-Workflow +For example, the following commands add a process object to the service object +in the `$x` variable. + +```powershell +Workflow Test-Workflow { -$x = Get-Service -$x = Get-Process -AppendOutput $true + $x = Get-Service + $x = Get-Process -AppendOutput $true } +``` -This parameter is designed for XAML-based workflows. In script -workflows, you can also use the += assignment operator to add -output to the value of a variable, as shown in the following -example. +This parameter is designed for XAML-based workflows. In script workflows, you +can also use the += assignment operator to add output to the value of a +variable, as shown in the following example. -workflow Test-Workflow +```powershell +Workflow Test-Workflow { -$x = Get-Service -$x += Get-Process + $x = Get-Service + $x += Get-Process } +``` --Debug -Displays programmer-level detail about the operation -performed by the command. The Debug parameter -overrides the value of the $DebugPreference variable -for the current command. This parameter works only -when the command generates debugging messages. This -parameter is also a Windows PowerShell common parameter. - --DisplayName -Specifies a friendly name for the activity. The -DisplayName value appears in the progress bar while -the workflow runs and in the value of the Progress -property of the workflow job. When the PSProgressMessage -parameter is also included in the command, the progress -bar content appears in : -format. - --ErrorAction -Determines how the activity responds to a non-terminating -error from the command. It has no effect on termination -errors. This parameter works only when the command -generates a non-terminating error, such as those from the -Write-Error cmdlet. The ErrorAction parameter overrides -the value of the $ErrorActionPreference variable for the -current command. This parameter is also a Windows PowerShell -common parameter. +#### Debug \ -Valid values: -Continue. Displays the error message and continues -executing the command. "Continue" is the default value. - -Ignore. Suppresses the error message and continues -executing the command. Unlike SilentlyContinue, Ignore -does not add the error message to the $Error automatic -variable. The Ignore value is introduced in Windows -PowerShell 3.0. - -Inquire. Displays the error message and prompts you for -confirmation before continuing execution. This value is -rarely used. - -Suspend. Automatically suspends a workflow job to allow for further -investigation. After investigation, the workflow can be resumed. - -SilentlyContinue. Suppresses the error message and -continues executing the command. - -Stop. Displays the error message and stops executing -the command. - --Input -Submits a collection of objects to an activity. This is an -alternative to piping objects to the activity one at a time. - --MergeErrorToOutput -A value of $True adds errors to the output stream. A value of -$False has not effect. Use this parameter with the Parallel and -ForEach -Parallel keywords to collect errors and output from -multiple parallel commands in a single collection. - --PSActionRetryCount -Tries repeatedly to run the activity if the first attempt -fails. The default value, 0, does not retry. - --PSActionRetryIntervalSec -Determines the interval between action retries in seconds. -The default value, 0, retries the action immediately. This -parameter is valid only when the PSActionRetryCount -parameter is also used in the command. - --PSActionRunningTimeoutSec -Determines how long the activity can run on each target -computer. If the activity does not complete before the -timeout expires, Windows PowerShell Workflow generates a -terminating error and stops processing the workflow on -the affected target computer. - --PSAllowRedirection -A value of $True allows redirection of the connection -to the target computers. A value of $False has no effect. -This activity common parameter is also a workflow common +Displays programmer-level detail about the operation performed by the command. +The Debug parameter overrides the value of the $DebugPreference variable for +the current command. This parameter works only when the command generates +debugging messages. This parameter is also a Windows PowerShell common parameter. -When you use the PSConnectionURI parameter, the remote -destination can return an instruction to redirect to a -different URI. By default, Windows PowerShell does not -redirect connections, but you can use the PSAllowRedirection -parameter with a value of $True to allow redirection of -the connection to the target computer. - -You can also limit the number of times that the connection -is redirected by setting the MaximumConnectionRedirectionCount -property of the $PSSessionOption preference variable, or -the MaximumConnectionRedirectionCount property of the value -of the SSessionOption parameter of cmdlets that create a -session. The default value is 5. - --PSApplicationName -Specifies the application name segment of the connection -URI that is used to connect to the target computers. Use -this parameter to specify the application name when you -are not using the ConnectionURI parameter in the command. -This activity common parameter is also a workflow common -parameter. +#### DisplayName \ -The default value is the value of the $PSSessionApplicationName -preference variable on the target computer. If this preference -variable is not defined, the default value is WSMAN. This value -is appropriate for most uses. For more information, see -[about_Preference_Variables](../../Microsoft.PowerShell.Core/About/about_Preference_Variables.md). +Specifies a friendly name for the activity. The DisplayName value appears in +the progress bar while the workflow runs and in the value of the Progress +property of the workflow job. When the PSProgressMessage parameter is also +included in the command, the progress bar content appears in +\:\ format. + +#### ErrorAction \ + +Determines how the activity responds to a non-terminating error from the +command. It has no effect on termination errors. This parameter works only when +the command generates a non-terminating error, such as those from the +Write-Error cmdlet. The ErrorAction parameter overrides the value of the +$ErrorActionPreference variable for the current command. This parameter is also +a Windows PowerShell common parameter. + +Valid values: + +- Continue. Displays the error message and continues executing + the command. "Continue" is the default value. + +- Ignore. Suppresses the error message and continues executing the command. + Unlike SilentlyContinue, Ignore does not add the error message to the $Error + automatic variable. The Ignore value is introduced in Windows PowerShell 3.0. + +- Inquire. Displays the error message and prompts you for confirmation before + continuing execution. This value is rarely used. + +- Suspend. Automatically suspends a workflow job to allow for further + investigation. After investigation, the workflow can be resumed. + +- SilentlyContinue. Suppresses the error message and continues executing the + command. + +- Stop. Displays the error message and stops executing the command. + +#### Input \ + +Submits a collection of objects to an activity. This is an alternative to +piping objects to the activity one at a time. + +#### MergeErrorToOutput \ + +A value of `$True` adds errors to the output stream. A value of `$False` has +not effect. Use this parameter with the Parallel and `ForEach -Parallel` +keywords to collect errors and output from multiple parallel commands +in a single collection. + +#### PSActionRetryCount \ + +Tries repeatedly to run the activity if the first attempt fails. The default +value, 0, does not retry. + +#### PSActionRetryIntervalSec \ + +Determines the interval between action retries in seconds. The default value, +0, retries the action immediately. This parameter is valid only when the +PSActionRetryCount parameter is also used in the command. -The WinRM service uses the application name to select a -listener to service the connection request. The value of -this parameter should match the value of the URLPrefix -property of a listener on the remote computer. - --PSAuthentication -Specifies the mechanism that is used to authenticate the -user's credentials when connecting to the target computers. -Valid values are Default, Basic, Credssp, Digest, Kerberos, -Negotiate, and NegotiateWithImplicitCredential. The default -value is Default. This activity common parameter is also a +#### PSActionRunningTimeoutSec \ + +Determines how long the activity can run on each target computer. If the +activity does not complete before the timeout expires, Windows PowerShell +Workflow generates a terminating error and stops processing the workflow on the +affected target computer. + +#### PSAllowRedirection \ + +A value of $True allows redirection of the connection to the target computers. +A value of $False has no effect. This activity common parameter is also a workflow common parameter. -For information about the values of this parameter, see the -description of the -System.Management.Automation.Runspaces.AuthenticationMechanism -enumeration in MSDN. - -CAUTION: Credential Security Service Provider (CredSSP) -authentication, in which the user's credentials are passed -to a remote computer to be authenticated, is designed for -commands that require authentication on more than one -resource, such as accessing a remote network share. This -mechanism increases the security risk of the remote operation. -If the remote computer is compromised, the credentials that -are passed to it can be used to control the network session. - --PSCertificateThumbprint -Specifies the digital public key certificate (X509) of a -user account that has permission to perform this action. Enter -the certificate thumbprint of the certificate. This activity -common parameter is also a workflow common parameter. +When you use the PSConnectionURI parameter, the remote destination can return +an instruction to redirect to a different URI. By default, Windows PowerShell +does not redirect connections, but you can use the PSAllowRedirection parameter +with a value of $True to allow redirection of the connection to the target +computer. + +You can also limit the number of times that the connection is redirected by +setting the MaximumConnectionRedirectionCount property of the `$PSSessionOption` +preference variable, or the MaximumConnectionRedirectionCount property of the +value of the SSessionOption parameter of cmdlets that create a session. The +default value is 5. + +#### PSApplicationName \ + +Specifies the application name segment of the connection URI that is used to +connect to the target computers. Use this parameter to specify the application +name when you are not using the ConnectionURI parameter in the command. This +activity common parameter is also a workflow common parameter. + +The default value is the value of the `$PSSessionApplicationName` preference +variable on the target computer. If this preference variable is not defined, +the default value is WSMAN. This value is appropriate for most uses. For more +information, see +[about_Preference_Variables](../../Microsoft.PowerShell.Core/About/about_Preference_Variables.md). -Certificates are used in client certificate-based authentication. -They can only be mapped to local user accounts; they do not -work with domain accounts. +The WinRM service uses the application name to select a listener to service the +connection request. The value of this parameter should match the value of the +URLPrefix property of a listener on the remote computer. -To get a certificate, use the Get-Item -(http://go.microsoft.com/fwlink/?LinkID=113319) or -Get-ChildItem (http://go.microsoft.com/fwlink/?LinkID=113308) -cmdlets in the Windows PowerShell Cert: drive. +#### PSAuthentication \ --PSComputerName -Specifies the target computers on which the activity run. -The default is the local computer. This activity common -parameter is also a workflow common parameter. +Specifies the mechanism that is used to authenticate the user's credentials +when connecting to the target computers. Valid values are Default, Basic, +Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The +default value is Default. This activity common parameter is also a workflow +common parameter. -Type the NETBIOS name, IP address, or fully-qualified -domain name of one or more computers in a comma-separated -list. To specify the local computer, type the computer name, -"localhost", or a dot (.). - -To include the local computer in the value of the -PSComputerName parameter, open Windows PowerShell with -the "Run as administrator" option. - -If this parameter is omitted from the command, or it value -is $null or an empty string, the workflow target is the local -computer and Windows PowerShell remoting is not used to run -the command. - -To use an IP address in the value of the ComputerName -parameter, the command must include the PSCredential -parameter. Also, the computer must be configured for HTTPS -transport or the IP address of the remote computer must be -included in the WinRM TrustedHosts list on the local computer. -For instructions for adding a computer name to the TrustedHosts -list, see "How to Add a Computer to the Trusted Host List" in -about_Remote_Troubleshooting -(http://go.microsoft.com/fwlink/?LinkID=135188). - --PSConfigurationName -Specifies the session configurations that are used to -create sessions on the target computers. Enter the name of a -session configuration on the target computers (not on the -computer that is running the workflow. The default is -Microsoft.PowerShell. This activity common parameter -is also a workflow common parameter. +For information about the values of this parameter, see the description of the +**System.Management.Automation.Runspaces.AuthenticationMechanism** enumeration in +MSDN. + +> [!WARNING] +> Credential Security Service Provider (CredSSP) authentication, in +> which the user's credentials are passed to a remote computer to be +> authenticated, is designed for commands that require authentication on more +> than one resource, such as accessing a remote network share. This mechanism +> increases the security risk of the remote operation. If the remote computer is +> compromised, the credentials that are passed to it can be used to control the +> network session. + +#### PSCertificateThumbprint \ --PSConnectionRetryCount -Specifies the maximum number of attempts to connect to -each target computer if the first connection attempt fails. -Enter a number between 1 and 4,294,967,295 (UInt.MaxValue). -The default value, zero (0), represents no retry attempts. -This activity common parameter is also a workflow common +Specifies the digital public key certificate (X509) of a user account that has +permission to perform this action. Enter the certificate thumbprint of the +certificate. This activity common parameter is also a workflow common parameter. --PSConnectionRetryIntervalSec -Specifies the delay between connection retry attempts in -seconds. The default value is zero (0). This parameter is -valid only when the value of PSConnectionRetryCount is at -least 1. This activity common parameter is also a workflow -common parameter. +Certificates are used in client certificate-based authentication. They can only +be mapped to local user accounts; they do not work with domain accounts. + +To get a certificate, use the [Get-Item](http://go.microsoft.com/fwlink/?LinkID=113319) +or [Get-ChildItem](http://go.microsoft.com/fwlink/?LinkID=113308) +cmdlets in the Windows PowerShell Cert: drive. --PSConnectionURI -Specifies a Uniform Resource Identifier (URI) that -defines the connection endpoint for the activity on -the target computer. The URI must be fully qualified. -This activity common parameter is also a workflow common +#### PSComputerName \ + +Specifies the target computers on which the activity run. The default is the +local computer. This activity common parameter is also a workflow common +parameter. + +Type the NETBIOS name, IP address, or fully-qualified domain name of one or +more computers in a comma-separated list. To specify the local computer, type +the computer name, "localhost", or a dot (.). + +To include the local computer in the value of the PSComputerName parameter, +open Windows PowerShell with the "Run as administrator" option. + +If this parameter is omitted from the command, or it value is $null or an empty +string, the workflow target is the local computer and Windows PowerShell +remoting is not used to run the command. + +To use an IP address in the value of the ComputerName parameter, the command +must include the PSCredential parameter. Also, the computer must be configured +for HTTPS transport or the IP address of the remote computer must be included +in the WinRM TrustedHosts list on the local computer. For instructions for +adding a computer name to the TrustedHosts list, see "How to Add a Computer to +the Trusted Host List" in +[about_Remote_Troubleshooting](http://go.microsoft.com/fwlink/?LinkID=135188). + +#### PSConfigurationName \ + +Specifies the session configurations that are used to create sessions on the +target computers. Enter the name of a session configuration on the target +computers (not on the computer that is running the workflow. The default is +Microsoft.PowerShell. This activity common parameter is also a workflow common parameter. +#### PSConnectionRetryCount \ + +Specifies the maximum number of attempts to connect to each target computer if +the first connection attempt fails. Enter a number between 1 and 4,294,967,295 +(UInt.MaxValue). The default value, zero (0), represents no retry attempts. +This activity common parameter is also a workflow common parameter. + +#### PSConnectionRetryIntervalSec \ + +Specifies the delay between connection retry attempts in seconds. The default +value is zero (0). This parameter is valid only when the value of +PSConnectionRetryCount is at least 1. This activity common parameter is also a +workflow common parameter. + +#### PSConnectionURI \ + +Specifies a Uniform Resource Identifier (URI) that defines the connection +endpoint for the activity on the target computer. The URI must be fully +qualified. This activity common parameter is also a workflow common parameter. + The format of this string is as follows: +``` ://:/ +``` The default value is http://localhost:5985/WSMAN. -If you do not specify a PSConnectionURI, you can -use the PSUseSSL, PSComputerName, PSPort, and -PSApplicationName parameters to specify the PSConnectionURI -values. - -Valid values for the Transport segment of the URI -are HTTP and HTTPS. If you specify a connection URI -with a Transport segment, but do not specify a port, -the session is created with standards ports: 80 for -HTTP and 443 for HTTPS. To use the default ports for -Windows PowerShell remoting, specify port 5985 for HTTP -or 5986 for HTTPS. - --PSCredential -Specifies a user account that has permission to -run the activity on the target computer. The default -is the current user. This parameter is valid only -when the PSComputerName parameter is included in the -command. This activity common parameter is also a -workflow common parameter. +If you do not specify a PSConnectionURI, you can use the PSUseSSL, +PSComputerName, PSPort, and PSApplicationName parameters to specify the +PSConnectionURI values. -Type a user name, such as "User01" or "Domain01\User01", -or enter a variable that contains a PSCredential object, -such as one that the Get-Credential cmdlet returns. If -you enter only a user name, you will be prompted for a -password. - --PSDebug -Adds debug messages from the activity to the specified -debug record collection, instead of writing the debug -messages to the console or to the value of the Debug -property of the workflow job. You can add debug messages -from multiple activities to the same debug record collection -object. +Valid values for the Transport segment of the URI are HTTP and HTTPS. If you +specify a connection URI with a Transport segment, but do not specify a port, +the session is created with standards ports: 80 for HTTP and 443 for HTTPS. To +use the default ports for Windows PowerShell remoting, specify port 5985 for +HTTP or 5986 for HTTPS. -To use this activity common parameter, use the New-Object -cmdlet to create a PSDataCollection object with a type of -DebugRecord and save the object in a variable. Then, use the -variable as the value of the PSDebug parameter of one or -more activities, as shown in the following example. +#### PSCredential \ -workflow Test-Workflow +Specifies a user account that has permission to run the activity on the target +computer. The default is the current user. This parameter is valid only when +the PSComputerName parameter is included in the command. This activity common +parameter is also a workflow common parameter. + +Type a user name, such as "User01" or "Domain01\User01", or enter a variable +that contains a PSCredential object, such as one that the Get-Credential cmdlet +returns. If you enter only a user name, you will be prompted for a password. + +#### PSDebug \ + +Adds debug messages from the activity to the specified debug record collection, +instead of writing the debug messages to the console or to the value of the +Debug property of the workflow job. You can add debug messages from multiple +activities to the same debug record collection object. + +To use this activity common parameter, use the New-Object cmdlet to create a +PSDataCollection object with a type of DebugRecord and save the object in a +variable. Then, use the variable as the value of the PSDebug parameter of one +or more activities, as shown in the following example. + +```powershell +Workflow Test-Workflow { -$debugCollection = New-Object -Type System.Management.Automation.PSDataCollection[System.Management.Automation.DebugRecord] -InlineScript {\Server01\Share01\Get-AssetData.ps1} -PSDebug $debugCollection -Debug $True -InlineScript {\Server01\Share01\Set-AssetData.ps1} -PSDebug $debugCollection -Debug $True -if ($debugCollection -like "Missing") { ...} + $debugCollection = New-Object -Type ` + System.Management.Automation.PSDataCollection[System.Management.Automation.DebugRecord] + InlineScript {\Server01\Share01\Get-AssetData.ps1} -PSDebug $debugCollection -Debug $True + InlineScript {\Server01\Share01\Set-AssetData.ps1} -PSDebug $debugCollection -Debug $True + if ($debugCollection -like "Missing") { ...} } +``` + +#### PSDisableSerialization \ --PSDisableSerialization -Directs the activity to return "live" (not serialized) -objects to the workflow. The resulting objects have -methods, as well as properties, but they cannot be +Directs the activity to return "live" (not serialized) objects to the workflow. +The resulting objects have methods, as well as properties, but they cannot be saved when a checkpoint is taken. --PSDisableSerializationPreference -Applies the equivalent of the PSDisableSerialization -parameter to the entire workflow, not just the activity. -Adding this parameter is generally not recommended, because -a workflow that doesn’t serialize its objects cannot be resumed -or persisted. +#### PSDisableSerializationPreference \ + +Applies the equivalent of the PSDisableSerialization parameter to the entire +workflow, not just the activity. Adding this parameter is generally not +recommended, because a workflow that doesn't serialize its objects cannot be +resumed or persisted. Valid values: --- (Default) If omitted, and you have also not added the -PSDisableSerialization parameter to an activity, -objects are serialized. - --- $True. Directs all activities within a workflow to return -"live" (not serialized) objects. The resulting objects have -methods, as well as properties, but they cannot be saved -when a checkpoint is taken. - --- $False. Workflow objects are serialized. - --PSError -Adds error messages from the activity to the specified error -record collection, instead of writing the error messages to -the console or to the value of the Error property of the -workflow job. You can add error messages from multiple + +- (Default) If omitted, and you have also not added the + PSDisableSerialization parameter to an activity, objects are serialized. + +- `$True`. Directs all activities within a workflow to return + "live" (not serialized) objects. The resulting objects have methods, as well + as properties, but they cannot be saved when a checkpoint is taken. +- `$False`. Workflow objects are serialized. + +#### PSError \ + +Adds error messages from the activity to the specified error record collection, +instead of writing the error messages to the console or to the value of the +Error property of the workflow job. You can add error messages from multiple activities to the same error record collection object. -To use this activity common parameter, use the New-Object -cmdlet to create a PSDataCollection object with a type -of ErrorRecord and save the object in a variable. Then, -use the variable as the value of the PSError parameter -of one or more activities, as shown in the following example. +To use this activity common parameter, use the `New-Object` cmdlet to create a +PSDataCollection object with a type of ErrorRecord and save the object in a +variable. Then, use the variable as the value of the PSError parameter of one +or more activities, as shown in the following example. -workflow Test-Workflow +```powershell +Workflow Test-Workflow { -$errorCollection = New-Object -Type System.Management.Automation.PSDataCollection[System.Management.Automation.ErrorRecord] -InlineScript {\Server01\Share01\Get-AssetData.ps1} -PSError $errorCollection -InlineScript {\Server01\Share01\Set-AssetData.ps1} -PSError $errorCollection -if ($errorCollection.Count -gt 2) { ...} + $typeName = "System.Management.Automation.PSDataCollection" + $typeName += '[System.Management.Automation.ErrorRecord]' + $ec = New-Object $typeName + InlineScript {\Server01\Share01\Get-AssetData.ps1} -PSError $ec + InlineScript {\Server01\Share01\Set-AssetData.ps1} -PSError $ec + if ($ec.Count -gt 2) + { + # Do Some Work. + } } +``` --PSPersist -Takes a checkpoint after the activity. This checkpoint -is in addition to any checkpoints that are specified in -the workflow. This activity common parameter is also a -workflow common parameter. +#### PSPersist \ + +Takes a checkpoint after the activity. This checkpoint is in addition to any +checkpoints that are specified in the workflow. This activity common parameter +is also a workflow common parameter. -A "checkpoint" or "persistence point" is a snapshot of the -workflow state and data that is captured while the workflow -runs and is saved to a persistence store on disk. Windows -PowerShell Workflow uses the saved data to resume a suspended -or interrupted workflow from the last persistence point, -rather than to restart the workflow. +A "checkpoint" or "persistence point" is a snapshot of the workflow state and +data that is captured while the workflow runs and is saved to a persistence +store on disk. Windows PowerShell Workflow uses the saved data to resume a +suspended or interrupted workflow from the last persistence point, rather than +to restart the workflow. Valid values: --- (Default) If you omit this parameter, no checkpoints are -added. Checkpoints are taken based on the settings for the -workflow. +- (Default) If you omit this parameter, no checkpoints are + added. Checkpoints are taken based on the settings for the workflow. --- $True. Takes a checkpoint after the activity completes. -This checkpoint is in addition to any checkpoints that -are specified in the workflow. +- `$True`. Takes a checkpoint after the activity completes. + This checkpoint is in addition to any checkpoints that are specified in + the workflow. --- $False. No checkpoints are added. Checkpoints are taken -only when specified in the workflow. +- `$False`. No checkpoints are added. Checkpoints are taken only when + specified in the workflow. --PSPort -Specifies the network port on the target computers. -The default ports are 5985 (the WinRM port for HTTP) -and 5986 (the WinRM port for HTTPS). This activity +#### PSPort \ + +Specifies the network port on the target computers. The default ports are 5985 +(the WinRM port for HTTP) and 5986 (the WinRM port for HTTPS). This activity common parameter is also a workflow common parameter. -Do not use the PSPort parameter unless you must. The -port set in the command applies to all computers or -sessions on which the command runs. An alternate port -setting might prevent the command from running on all -computers. Before using an alternate port, you must -configure the WinRM listener on the remote computer -to listen at that port. - --PSProgress -Adds progress messages from the activity to the -specified progress record collection, instead of -writing the progress messages to the console or -to the value of the Progress property of the -workflow job. You can add progress messages -from multiple activities to the same progress -record collection object. - --PSProgressMessage -Specifies a friendly description of the activity. -The PSProgressMessage value appears in the progress -bar while the workflow runs. When the DisplayName is -also included in the command, the progress bar content -appears in : format. - -This parameter is particularly useful for identifying -activities in a ForEach -Parallel script block. Without -this message, activities in all parallel branches are -identified by the same name. - --PSRemotingBehavior -Specifies how remoting is managed when the activity is -run on target computers. PowerShell is the default. +Do not use the PSPort parameter unless you must. The port set in the command +applies to all computers or sessions on which the command runs. An alternate +port setting might prevent the command from running on all computers. Before +using an alternate port, you must configure the WinRM listener on the remote +computer to listen at that port. + +#### PSProgress \ + +Adds progress messages from the activity to the specified progress record +collection, instead of writing the progress messages to the console or to the +value of the Progress property of the workflow job. You can add progress +messages from multiple activities to the same progress record collection +object. + +#### PSProgressMessage \ + +Specifies a friendly description of the activity. The PSProgressMessage value +appears in the progress bar while the workflow runs. When the DisplayName is +also included in the command, the progress bar content appears in +\:\ format. + +This parameter is particularly useful for identifying activities in a ForEach +-Parallel script block. Without this message, activities in all parallel +branches are identified by the same name. + +#### PSRemotingBehavior \ + +Specifies how remoting is managed when the activity is run on target computers. +PowerShell is the default. Valid values are: -None: The activity is not run on remote computers. - -PowerShell: Windows PowerShell remoting is used to -run the activity on target computers. - -Custom: The activity supports its own type of remoting. -This value is valid when the cmdlet that is being -implemented as an activity sets the value of the -RemotingCapability attribute to SupportedByCommand and -the command includes the ComputerName parameter. - --PSRequiredModules -Imports the specified modules before running the command. -Enter the module names. The modules must be installed on -the target computer. - -Modules that are installed in a path specified in the -PSModulePath environment variable are automatically -imported on first use of any command in the module. Use -this parameter to import modules that are not in a -PSModulePath location. - -Because each activity in a workflow runs in its own -session, an Import-Module command imports a module only -into the session in which it runs. It does not import the -module into sessions in which other activities run. - --PSSessionOption -Sets advanced options for the sessions to the -target computers. Enter a PSSessionOption object, -such as one that you create by using the New-PSSessionOption -cmdlet. This activity common parameter is also a workflow +- None: The activity is not run on remote computers. + +- PowerShell: Windows PowerShell remoting is used to run the activity on + target computers. + +- Custom: The activity supports its own type of remoting. This value is valid + when the cmdlet that is being implemented as an activity sets the value of + the RemotingCapability attribute to SupportedByCommand and the command + includes the ComputerName parameter. + +#### PSRequiredModules \ + +Imports the specified modules before running the command. Enter the module +names. The modules must be installed on the target computer. + +Modules that are installed in a path specified in the PSModulePath environment +variable are automatically imported on first use of any command in the module. +Use this parameter to import modules that are not in a PSModulePath location. + +Because each activity in a workflow runs in its own session, an Import-Module +command imports a module only into the session in which it runs. It does not +import the module into sessions in which other activities run. + +#### PSSessionOption \ + +Sets advanced options for the sessions to the target computers. Enter a +PSSessionOption object, such as one that you create by using the +New-PSSessionOption cmdlet. This activity common parameter is also a workflow common parameter. -The default values for the session options are -determined by the value of the $PSSessionOption -preference variable, if it is set. Otherwise, the -session uses the values specified in the session -configuration. - -For a description of the session options, including -the default values, see the help topic for the -New-PSSessionOption cmdlet -(http://go.microsoft.com/fwlink/?LinkID=144305). - -For more information about the $PSSessionOption -preference variable, see [about_Preference_Variables](../../Microsoft.PowerShell.Core/About/about_Preference_Variables.md). - --PSUseSSL -A value of $True uses the Secure Sockets Layer (SSL) -protocol to establish a connection to the target -computer. By default, SSL is not used. A value of $False -has no effect. This activity common parameter is also -a workflow common parameter. - -WS-Management encrypts all Windows PowerShell -content transmitted over the network. UseSSL is -an additional protection that sends the data across -an HTTPS, instead of HTTP. If you use this parameter, -but SSL is not available on the port used for the -command, the command fails. - --PSVerbose -Adds verbose messages from the activity to the -specified verbose record collection, instead of -writing the verbose messages to the console or -to the value of the Verbose property of the workflow -job. You can add verbose messages from multiple -activities to the same verbose record collection -object. +The default values for the session options are determined by the value of the +`$PSSessionOption` preference variable, if it is set. Otherwise, the session +uses the values specified in the session configuration. + +For a description of the session options, including the default values, see the +help topic for the New-PSSessionOption cmdlet +[New-PSSessionOption](http://go.microsoft.com/fwlink/?LinkID=144305). + +For more information about the $PSSessionOption preference variable, see +[about_Preference_Variables](../../Microsoft.PowerShell.Core/About/about_Preference_Variables.md). --PSWarning -Adds warning messages from the activity to the -specified warning record collection, instead of -writing the warning messages to the console or -to the value of the Warning property of the -workflow job. You can add warning messages from -multiple activities to the same warning record -collection object. +#### PSUseSSL \ + +A value of $True uses the Secure Sockets Layer (SSL) protocol to establish a +connection to the target computer. By default, SSL is not used. A value of +$False has no effect. This activity common parameter is also a workflow common +parameter. + +WS-Management encrypts all Windows PowerShell content transmitted over the +network. UseSSL is an additional protection that sends the data across an +HTTPS, instead of HTTP. If you use this parameter, but SSL is not available on +the port used for the command, the command fails. + +#### PSVerbose \ + +Adds verbose messages from the activity to the specified verbose record +collection, instead of writing the verbose messages to the console or to the +value of the Verbose property of the workflow job. You can add verbose messages +from multiple activities to the same verbose record collection object. + +#### PSWarning \ + +Adds warning messages from the activity to the specified warning record +collection, instead of writing the warning messages to the console or to the +value of the Warning property of the workflow job. You can add warning messages +from multiple activities to the same warning record collection object. + +#### Result --Result This parameter is valid only in XAML workflows. --UseDefaultInput -Accepts all workflow input as input to the -activity by value. +#### UseDefaultInput \ + +Accepts all workflow input as input to the activity by value. -For example, the Get-Process activity in the -following sample workflow uses the UseDefaultInput -activity common parameter to get input that is -passed to the workflow. When you run the workflow -with input, that input is used by the activity. +For example, the Get-Process activity in the following sample workflow uses the +UseDefaultInput activity common parameter to get input that is passed to the +workflow. When you run the workflow with input, that input is used by the +activity. +```powershell workflow Test-Workflow { -Get-Service -UseDefaultInput $True + Get-Service -UseDefaultInput $True } PS C:> Test-Workflow -InputObject WinRm +``` -Status Name DisplayName PSComputerName ------- ---- ----------- -------------- -Running winrm Windows Remote Management (WS-Manag... localhost - --Verbose -Displays detailed information about the -operation performed by the command. This -information resembles the information in a -trace or in a transaction log. The Verbose -parameter overrides the value of the -$VerbosePreference variable for the current -command. This parameter works only when the -command generates a verbose message. This -parameter is also a Windows PowerShell common -parameter. +```output +Status Name DisplayName PSComputerName +------ ---- ----------- -------------- +Running winrm Windows Remote Management (WS-Manag... localhost +``` + +#### Verbose \ --WarningAction -Determines how the activity responds to a warning. -"Continue" is the default value. The WarningAction -parameter overrides the value of the $WarningPreference -variable for the current command. This parameter works -only when the command generates a warning message. This -parameter is also a Windows PowerShell common parameter. +Displays detailed information about the operation performed by the command. +This information resembles the information in a trace or in a transaction log. +The Verbose parameter overrides the value of the $VerbosePreference variable +for the current command. This parameter works only when the command generates a +verbose message. This parameter is also a Windows PowerShell common parameter. + +#### WarningAction \ + +Determines how the activity responds to a warning. "Continue" is the default +value. The WarningAction parameter overrides the value of the +$WarningPreference variable for the current command. This parameter works only +when the command generates a warning message. This parameter is also a Windows +PowerShell common parameter. Valid Values: -SilentlyContinue. Suppresses the warning message -and continues executing the command. +- SilentlyContinue. Suppresses the warning message and continues executing the + command. -Continue. Displays the warning message and continues -executing the command. "Continue" is the default -value. +- Continue. Displays the warning message and continues executing the command. + "Continue" is the default value. -Inquire. Displays the warning message and prompts -you for confirmation before continuing execution. -This value is rarely used. +- Inquire. Displays the warning message and prompts you for confirmation before + continuing execution. This value is rarely used. -Stop. Displays the warning message and stops -executing the command. +- Stop. Displays the warning message and stops executing the command. -NOTE: The WarningAction parameter does not override -the value of the $WarningAction preference variable -when the parameter is used in a command to run a -script or function. +> [!NOTE] +> The WarningAction parameter does not override +> the value of the $WarningAction preference variable +> when the parameter is used in a command to run a +> script or function. -# EXAMPLES +### EXAMPLES -The activity common parameters are extremely useful. -For example, you can use the PSComputerName parameter -to run particular activities on only a subset of the -target computers. +The activity common parameters are extremely useful. For example, you can use +the PSComputerName parameter to run particular activities on only a subset of +the target computers. -Or, you might use the PSConnectionRetryCount and -PSConnectionRetryIntervalSec parameters to adjust the -retry values for particular activities. +Or, you might use the PSConnectionRetryCount and PSConnectionRetryIntervalSec +parameters to adjust the retry values for particular activities. -The following example shows how to use the PSComputerName -activity common parameters to run a Get-EventLog activity -only on computers it a particular domain. +The following example shows how to use the PSComputerName activity common +parameters to run a Get-EventLog activity only on computers it a particular +domain. +```powershell Workflow Test-Workflow { -$UserDomain = Get-Content -Path .\UserComputers.txt -$Log = (Get-EventLog -LogName "Windows PowerShell" -PSComputerName $UserDomain} -if ($Log) ... + $UserDomain = Get-Content -Path '.\UserComputers.txt' + $Log = (Get-EventLog -LogName "Windows PowerShell" ` + -PSComputerName $UserDomain) + + if ($Log) + { + # Do Work Here. + } } +``` + -about_Activity_Common_Parameters -about_Activity_Parameters -about_ActivityParameters - -# SEE ALSO +## SEE ALSO -about_Workflows -about_WorkflowCommonParameters \ No newline at end of file +[about_Workflows](about_workflows.md) +[about_WorkflowCommonParameters](about_WorkflowCommonParameters.md) \ No newline at end of file diff --git a/reference/5.0/PSWorkflow/About/about_Parallel.md b/reference/5.0/PSWorkflow/About/about_Parallel.md index 709438ebb8d3..b39d8295e943 100644 --- a/reference/5.0/PSWorkflow/About/about_Parallel.md +++ b/reference/5.0/PSWorkflow/About/about_Parallel.md @@ -5,20 +5,18 @@ locale: en-us keywords: powershell,cmdlet title: about_Parallel --- - # About Parallel ## SHORT DESCRIPTION -Describes the Parallel keyword, which runs the activities in a workflow in parallel. +Describes the Parallel keyword, which runs the activities in a workflow in parallel. ## LONG DESCRIPTION -The Parallel keyword runs workflow activities in parallel. This keyword is valid only in Windows PowerShell® Workflow. +The Parallel keyword runs workflow activities in parallel. This keyword is valid only in Windows PowerShell Workflow. ### SYNTAX - ``` workflow { @@ -31,15 +29,13 @@ workflow } ``` - - ## DETAILED DESCRIPTION + The commands in a Parallel script block can run concurrently. The order in which they run is not determined. For example, the following workflow includes a Parallel script block that runs activities that get processes and services on the computer. Because the Get-Process and Get-Service commands are independent of each other, they can run concurrently and in any order. - -``` +```powershell workflow Test-Workflow { Parallel @@ -50,23 +46,22 @@ workflow Test-Workflow } ``` - Running commands in parallel is very efficient and reduces the time it takes to complete a workflow significantly. To run selected commands in a Parallel script block in sequential order, use the Sequence keyword. For more information, see about_Sequence. To run a Parallel script block on items in a collection, use the ForEach or ForEach -Parallel keywords. - ## SEE ALSO -[Writing a Script Workflow](http://go.microsoft.com/fwlink/?LinkID=262872) -about_ForEach +["Writing a Script Workflow"](/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/jj574157(v=ws.11)) + +[about_ForEach](../../Microsoft.PowerShell.Core/About/about_Foreach.md) -about_ForEach-Parallel +[about_ForEach-Parallel](about_ForEach-Parallel.md) -about_Language_Keywords +[about_Language_Keywords](../../Microsoft.PowerShell.Core/About/about_Language_Keywords.md) -about_Sequence +[about_Sequence](about_Sequence.md) -about_Workflows \ No newline at end of file +[about_Workflows](about_workflows.md) \ No newline at end of file