diff --git a/reference/5.1/CimCmdlets/Get-CimAssociatedInstance.md b/reference/5.1/CimCmdlets/Get-CimAssociatedInstance.md index c48998f2ecc2..fac7ab79c2d7 100644 --- a/reference/5.1/CimCmdlets/Get-CimAssociatedInstance.md +++ b/reference/5.1/CimCmdlets/Get-CimAssociatedInstance.md @@ -57,7 +57,7 @@ $disk = Get-CimInstance -ClassName Win32_LogicalDisk -KeyOnly Get-CimAssociatedInstance -InputObject $disk[1] ``` -This set of commands retrieves the instances of the class named Win32_LogicalDisk and stores the +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. @@ -200,7 +200,7 @@ Accept wildcard characters: False ### -Namespace -Specifies the namespace for the CIM operation. The default namespace is root/cimv2. +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 PowerShell gets a list of @@ -254,11 +254,11 @@ A URI consists of a prefix and a path to a resource. For example: By default, if you don't 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 +**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 get an error, because the DCOM protocol doesn't support the -**ResourceURI** parameter. +**ResourceUri** parameter. If both the **ResourceUri** parameter and the **Filter** parameter are specified, the **Filter** parameter is ignored. @@ -284,7 +284,7 @@ name. By default, the value of this parameter is null, and all associated CIM instances are returned. You can filter the association results to match a specific class name. Filtering happens on the -server. If this parameter isn't specified, `Get-CIMAssociatedInstance` returns all existing +server. If this parameter isn't specified, `Get-CimAssociatedInstance` returns all existing associations. For example, if class A is associated with classes B, C and D, then this parameter can be used to restrict the output to a specific type (B, C or D). diff --git a/reference/5.1/CimCmdlets/Get-CimClass.md b/reference/5.1/CimCmdlets/Get-CimClass.md index ec0b548d575c..38464ea835a7 100644 --- a/reference/5.1/CimCmdlets/Get-CimClass.md +++ b/reference/5.1/CimCmdlets/Get-CimClass.md @@ -41,7 +41,7 @@ instance, CIM classes do not contain the CIM session or computer name from which ### Example 1: Get all the class definitions -This example gets all the class definitions under the namespace **root/cimv2**. +This example gets all the class definitions under the namespace **root/CIMV2**. ```powershell Get-CimClass @@ -49,10 +49,10 @@ Get-CimClass ### Example 2: Get the classes with a specific name -This example gets the classes that contain the word **disk** in their names. +This example gets the classes that contain the word **Disk** in their names. ```powershell -Get-CimClass -ClassName *disk* +Get-CimClass -ClassName *Disk* ``` ### Example 3: Get the classes with a specific method name @@ -85,26 +85,26 @@ Get-CimClass -ClassName Win32*Disk* -QualifierName Association ### Example 6: Get the class definitions from a specific namespace This example gets the class definitions that contain the word **Net** in their names from the -specified namespace **root/standardCimv2**. +specified namespace **root/StandardCimv2**. ```powershell -Get-CimClass -Namespace root/standardCimv2 -ClassName *Net* +Get-CimClass -Namespace root/StandardCimv2 -ClassName *Net* ``` ### Example 7: Get the class definitions from a remote server -This example gets the class definitions that contain the word **disk** in their names from the +This example gets the class definitions that contain the word **Disk** in their names from the specified remote servers **Server01** and **Server02**. ```powershell -Get-CimClass -ClassName *disk* -ComputerName Server01, Server02 +Get-CimClass -ClassName *Disk* -ComputerName Server01, Server02 ``` ### Example 8: Get the classes by using a CIM session ```powershell $s = New-CimSession -ComputerName Server01, Server02 -Get-CimClass -ClassName *disk* -CimSession $s +Get-CimClass -ClassName *Disk* -CimSession $s ``` This set of commands creates a session with multiple computers and stores it into a variable `$s` @@ -193,7 +193,7 @@ Accept wildcard characters: True ### -Namespace -Specifies the namespace for CIM operation. The default namespace is **root/cimv2**. You can use tab +Specifies the namespace for CIM operation. The default namespace is **root/CIMV2**. 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. diff --git a/reference/5.1/CimCmdlets/Get-CimInstance.md b/reference/5.1/CimCmdlets/Get-CimInstance.md index 545e71aa7b9b..2df04a5ec8de 100644 --- a/reference/5.1/CimCmdlets/Get-CimInstance.md +++ b/reference/5.1/CimCmdlets/Get-CimInstance.md @@ -111,7 +111,7 @@ Get-CimInstance -ClassName Win32_Process ### Example 2: Get a list of namespaces from a WMI server -This example retrieves a list of namespaces under the **Root** namespace on a WMI server. +This example retrieves a list of namespaces under the **root** namespace on a WMI server. ```powershell Get-CimInstance -Namespace root -ClassName __Namespace @@ -144,7 +144,7 @@ a CIM instance to the `Get-CimInstance` cmdlet to get a particular instance. ```powershell $instance = @{ ClassName = 'Win32_Process' - Namespace = 'root\cimv2' + Namespace = 'root/CIMV2' Properties = @{ Handle = 0 } @@ -349,7 +349,7 @@ Accept wildcard characters: False Specifies the namespace of CIM class. -The default namespace is **root/cimv2**. You can use tab completion to browse the list of +The default namespace is **root/CIMV2**. 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. @@ -463,11 +463,11 @@ A URI consists of a prefix and a path to a resource. For example: 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 +**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** parameter. If both the **ResourceUri** parameter and the **Filter** parameter are specified, the **Filter** parameter is ignored. diff --git a/reference/5.1/CimCmdlets/Get-CimSession.md b/reference/5.1/CimCmdlets/Get-CimSession.md index e322962136aa..38af8b1650c7 100644 --- a/reference/5.1/CimCmdlets/Get-CimSession.md +++ b/reference/5.1/CimCmdlets/Get-CimSession.md @@ -94,7 +94,7 @@ Protocol : WSMAN ### Example 3: Get a list of CIM sessions and then format the list This example gets all CIM sessions in the current PowerShell session and displays a table containing -only the **ComputerName** and **InstanceID** properties. +only the **ComputerName** and **InstanceId** properties. ```powershell Get-CimSession | Format-Table -Property ComputerName, InstanceId @@ -109,7 +109,7 @@ Server02 c0095981-52c5-4e7f-a5bb-c4c680541710 ### Example 4: Get all the CIM sessions that have specific names -This example gets all CIM sessions that have names that begin with **serv**. +This example gets all CIM sessions that have names that begin with **Serv**. ```powershell Get-CimSession -ComputerName Serv* diff --git a/reference/5.1/CimCmdlets/Invoke-CimMethod.md b/reference/5.1/CimCmdlets/Invoke-CimMethod.md index a603a0d6c453..f2662bbb8947 100644 --- a/reference/5.1/CimCmdlets/Invoke-CimMethod.md +++ b/reference/5.1/CimCmdlets/Invoke-CimMethod.md @@ -154,12 +154,12 @@ Invoke-CimMethod -ClassName Win32_Process -MethodName "Create" -Arguments @{ ### Example 4: Client-side validation -This example performs client-side validation for the **xyz** method by passing a **CimClass** object +This example performs client-side validation for the **Foo** method by passing a **CimClass** object to `Invoke-CimMethod`. ```powershell $c = Get-CimClass -ClassName Win32_Process -Invoke-CimMethod -CimClass $c -MethodName "xyz" -Arguments @{CommandLine='notepad.exe'} +Invoke-CimMethod -CimClass $c -MethodName "Foo" -Arguments @{CommandLine='notepad.exe'} ``` ## PARAMETERS @@ -300,7 +300,7 @@ Accept wildcard characters: False ### -Namespace -Specifies the namespace for the CIM operation. The default namespace is **root/cimv2**. You can use +Specifies the namespace for the CIM operation. The default namespace is **root/CIMV2**. 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. @@ -392,12 +392,12 @@ A URI consists of a prefix and a path to a resource. For example: 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 +**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. When you specify this parameter without specifying the **ComputerName** parameter, or when you specify a CIM session created using DCOM protocol, you get an error. The DCOM protocol does not -support the **ResourceURI** parameter. +support the **ResourceUri** parameter. If both the **ResourceUri** parameter and the **Filter** parameter are specified, the **Filter** parameter is ignored. diff --git a/reference/5.1/CimCmdlets/New-CimInstance.md b/reference/5.1/CimCmdlets/New-CimInstance.md index 615c56591734..b87a1da636d1 100644 --- a/reference/5.1/CimCmdlets/New-CimInstance.md +++ b/reference/5.1/CimCmdlets/New-CimInstance.md @@ -73,8 +73,8 @@ instance on the local computer. ### Example 1: Create an instance of a CIM class -This example creates an instance of a CIM Class named win32_environment in the root/cimv2 namespace -on the computer. +This example creates an instance of a CIM Class named **Win32_Environment** in the **root/CIMV2** +namespace on the computer. ```powershell $prop = @{ @@ -276,7 +276,7 @@ Accept wildcard characters: False ### -Namespace -Specifies the namespace of the class for the new instance. The default namespace is **root/cimv2**. +Specifies the namespace of the class for the new instance. The default namespace is **root/CIMV2**. 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. @@ -348,11 +348,11 @@ A URI consists of a prefix and a path to a resource. For example: 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 +**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** parameter. If both the **ResourceUri** parameter and the **Filter** parameter are specified, the **Filter** parameter is ignored. diff --git a/reference/5.1/CimCmdlets/New-CimSession.md b/reference/5.1/CimCmdlets/New-CimSession.md index 4c91492c9e4e..a09d05cfd56f 100644 --- a/reference/5.1/CimCmdlets/New-CimSession.md +++ b/reference/5.1/CimCmdlets/New-CimSession.md @@ -109,7 +109,7 @@ New-CimSession -ComputerName Server01 -Port 1234 This example creates a CIM session using the Distributed COM (DCOM) protocol instead of WSMan. ```powershell -$SessionOption = New-CimSessionOption -Protocol DCOM +$SessionOption = New-CimSessionOption -Protocol Dcom New-CimSession -ComputerName Server1 -SessionOption $SessionOption ``` diff --git a/reference/5.1/CimCmdlets/New-CimSessionOption.md b/reference/5.1/CimCmdlets/New-CimSessionOption.md index 2d84d37a831b..cfa4631f6deb 100644 --- a/reference/5.1/CimCmdlets/New-CimSessionOption.md +++ b/reference/5.1/CimCmdlets/New-CimSessionOption.md @@ -60,7 +60,7 @@ named `$so`. The contents of the variable are then passed to the `New-CimSession options defined in the variable. ```powershell -$so = New-CimSessionOption -Protocol DCOM +$so = New-CimSessionOption -Protocol Dcom New-CimSession -ComputerName Server01 -SessionOption $so ``` @@ -85,7 +85,7 @@ New-CimSessionOption @option ### Example 3: Create a CIM session options object with the culture specified ```powershell -New-CimSessionOption -Culture Fr-Fr -Protocol Wsman +New-CimSessionOption -Culture fr-FR -Protocol Wsman ``` This example specifies the culture that is used for the CIM session. By default, the culture of the @@ -99,7 +99,7 @@ client is used when performing operations. However, the default culture can be o Specifies the user interface culture to use for the CIM session. Specify the value for this parameter using one of the following formats: -- A culture name in `-` format such as "EN-US". +- A culture name in `-` format such as "en-US". - A variable that contains a **CultureInfo** object. - A command that gets a **CultureInfo** object, such as [Get-Culture](../Microsoft.PowerShell.Utility/Get-Culture.md) @@ -266,7 +266,7 @@ Accept wildcard characters: False ### -Protocol -Specifies the protocol to use. The acceptable values for this parameter are: **DCOM**, **Default**, +Specifies the protocol to use. The acceptable values for this parameter are: **Dcom**, **Default**, or **Wsman**. ```yaml @@ -425,7 +425,7 @@ Accept wildcard characters: False Specifies the user interface culture to use for the CIM session. Specify the value for this parameter using one of the following formats: -- A culture name in `-` format such as "EN-US". +- A culture name in `-` format such as "en-US". - A variable that contains a CultureInfo object. - A command that gets a CultureInfo object, such as `Get-Culture`. diff --git a/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md b/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md index b8d5e37c204d..d9353a70d167 100644 --- a/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md +++ b/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md @@ -269,7 +269,7 @@ Accept wildcard characters: False ### -Namespace -Specifies the namespace for the CIM operation. The default namespace is **root/cimv2**. You can use +Specifies the namespace for the CIM operation. The default namespace is **root/CIMV2**. 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. diff --git a/reference/5.1/CimCmdlets/Remove-CimInstance.md b/reference/5.1/CimCmdlets/Remove-CimInstance.md index 07dea4673abe..55e511ada2ad 100644 --- a/reference/5.1/CimCmdlets/Remove-CimInstance.md +++ b/reference/5.1/CimCmdlets/Remove-CimInstance.md @@ -153,7 +153,7 @@ Accept wildcard characters: False ### -Namespace -Specifies the namespace for the CIM operation. The default namespace is `root/cimv2`. You can use +Specifies the namespace for the CIM operation. The default namespace is **root/CIMV2**. 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. @@ -244,11 +244,11 @@ A URI consists of a prefix and a path to a resource. For example: 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 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 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. diff --git a/reference/5.1/CimCmdlets/Set-CimInstance.md b/reference/5.1/CimCmdlets/Set-CimInstance.md index de58c8f0fb70..b819def2ee4e 100644 --- a/reference/5.1/CimCmdlets/Set-CimInstance.md +++ b/reference/5.1/CimCmdlets/Set-CimInstance.md @@ -234,9 +234,9 @@ Accept wildcard characters: False ### -Namespace -Specifies the namespace for the CIM operation. The default namespace is root/cimv2. 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. +Specifies the namespace for the CIM operation. The default namespace is **root/CIMV2**. 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 Type: System.String @@ -360,11 +360,11 @@ A URI consists of a prefix and a path to a resource. For example: 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. diff --git a/reference/5.1/ISE/Get-IseSnippet.md b/reference/5.1/ISE/Get-IseSnippet.md index e86da9673ef9..8e0853d00802 100644 --- a/reference/5.1/ISE/Get-IseSnippet.md +++ b/reference/5.1/ISE/Get-IseSnippet.md @@ -71,7 +71,7 @@ function Parse-Snippet { foreach ($SnippetFile in $SnippetFiles) { Write-Host "" $Title = Select-Xml -Path $SnippetFile.FullName -Namespace $SnippetNamespace -XPath "//x:Title" | - ForEach-Object {$_.Node.InnerXML} + ForEach-Object {$_.Node.InnerXml} $Text = Select-Xml -Path $SnippetFile.FullName -Namespace $SnippetNamespace -XPath "//x:Script" | ForEach-Object {$_.Node.InnerText} Write-Host "Title: $Title" @@ -83,10 +83,10 @@ function Parse-Snippet { ```Output Title: Mandatory Text: -Param +param ( - [parameter(Mandatory=True)] - [String[]] + [Parameter(Mandatory=True)] + [string[]] $ ) @@ -138,7 +138,7 @@ This cmdlet returns a file object representing the snippet file. ## NOTES -- The `New-IseSnippet` cmdlet stores new user-created snippets in unsigned .ps1xml files. As such, +- The `New-IseSnippet` cmdlet 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. diff --git a/reference/5.1/ISE/Import-IseSnippet.md b/reference/5.1/ISE/Import-IseSnippet.md index 79a6891690f1..146e165cdef9 100644 --- a/reference/5.1/ISE/Import-IseSnippet.md +++ b/reference/5.1/ISE/Import-IseSnippet.md @@ -38,7 +38,7 @@ Snippets** or press Ctrl+J. 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`. +`$HOME\Documents\WindowsPowerShell\Snippets`. 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` @@ -78,9 +78,9 @@ Import-IseSnippet -Module SnippetModule -ListAvailable This example gets snippets in all installed modules in the **PSModulePath** environment variable. ```powershell -($env:PSModulePath).split(";") | +($Env:PSModulePath).Split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | - ForEach-Object {$_.Fullname} + ForEach-Object {$_.FullName} ``` ### Example 4: Import all module snippets @@ -90,7 +90,7 @@ you don't need to run a command like this because modules that have snippets wil `Import-IseSnippet` cmdlet to import them for you when the module is imported. ```powershell -($env:PSModulePath).split(";") | +($Env:PSModulePath).Split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | ForEach-Object {$psISE.CurrentPowerShellTab.Snippets.Load($_)} ``` @@ -102,7 +102,7 @@ the current user. Unlike imported snippets, which affect only the current sessio are available in every Windows PowerShell ISE session. ```powershell -($env:PSModulePath).split(";") | +($Env:PSModulePath).Split(";") | ForEach-Object {dir $_\*\Snippets\*.Snippets.ps1xml -ErrorAction SilentlyContinue} | Copy-Item -Destination $HOME\Documents\WindowsPowerShell\Snippets ``` @@ -215,7 +215,7 @@ This cmdlet returns no output. **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, +- 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. diff --git a/reference/5.1/ISE/New-IseSnippet.md b/reference/5.1/ISE/New-IseSnippet.md index 00c681717119..c65096020718 100644 --- a/reference/5.1/ISE/New-IseSnippet.md +++ b/reference/5.1/ISE/New-IseSnippet.md @@ -66,10 +66,10 @@ This command creates a Comment-BasedHelp snippet for Windows PowerShell ISE. It ```powershell $M = @' -Param +param ( - [parameter(Mandatory=$true)] - [String[]] + [Parameter(Mandatory=$true)] + [string[]] $ ) '@ @@ -227,7 +227,7 @@ This cmdlet returns no output. ## NOTES -`New-IseSnippet` stores new user-created snippets in unsigned .ps1xml files. As such, Windows +`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. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/About.md b/reference/5.1/Microsoft.PowerShell.Core/About/About.md index b00906ae222e..0cd214343b49 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/About.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/About.md @@ -150,7 +150,7 @@ Provides a brief introduction to the PowerShell Desired State Configuration ### [about_Do](about_Do.md) -Runs a statement list one or more times, subject to a `While` or `Until` +Runs a statement list one or more times, subject to a `while` or `until` condition. ### [about_Enum](about_Enum.md) @@ -267,8 +267,8 @@ expression in the background without interacting with the current session. ### [about_Join](about_Join.md) -Describes how the join operator (-join) combines multiple strings into a single -string. +Describes how the join operator (`-join`) combines multiple strings into a +single string. ### [about_Language_Keywords](about_Language_Keywords.md) @@ -377,7 +377,7 @@ command-line parameters and describes the syntax. ### [about_PowerShell_Ise_exe](about_PowerShell_Ise_exe.md) -Explains how to use the PowerShell_Ise.exe command-line tool. +Explains how to use the `powershell_ise.exe` command-line tool. ### [about_Preference_Variables](about_Preference_Variables.md) @@ -389,8 +389,8 @@ Describes how to create and use a PowerShell profile. ### [about_Prompts](about_Prompts.md) -Describes the `Prompt` function and demonstrates how to create a custom -`Prompt` function. +Describes the `prompt` function and demonstrates how to create a custom +`prompt` function. ### [about_Properties](about_Properties.md) @@ -417,7 +417,7 @@ The automatic variable that contains the current object in the pipeline object. ### [about_PSModulePath](about_PSModulePath.md) -This article the purpose and usage of the `$env:PSModulePath` environment +This article the purpose and usage of the `$Env:PSModulePath` environment variable. ### [about_PSSession_Details](about_PSSession_Details.md) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md index 2549cd0ecdd9..aa1ae33a966a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_ANSI_Terminals.md @@ -3,7 +3,7 @@ description: Describes the features of PowerShell that use ANSI escape sequences Locale: en-US ms.date: 03/01/2023 schema: 2.0.0 -title: about_ANSI_terminals +title: about_ANSI_Terminals --- # about_ANSI_Terminals diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md index 86d20bd307af..492611cd599d 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Alias_Provider.md @@ -149,7 +149,7 @@ current location is in the `Alias:` drive, the `-Path` parameter is not needed. This command also uses the `-Options` dynamic parameter to set the **AllScope** option on the alias. The `-Options` parameter is available in the `New-Item` cmdlet only when you are in the `Alias:` drive. The dot (`.`) indicates the -current directory, which is the alias drive. +current directory, which is the `Alias:` drive. ``` PS Alias:\> New-Item -Path . -Name serv -Value Get-Service -Options "AllScope" @@ -161,7 +161,7 @@ You can create an alias for any item that invokes a command. This command creates the `np` alias for `Notepad.exe`. ```powershell -New-Item -Path Alias:np -Value c:\windows\notepad.exe +New-Item -Path Alias:np -Value C:\windows\notepad.exe ``` ### Create an alias to a new function @@ -177,7 +177,7 @@ When the command is complete, you can use either `CD32` or `go` to invoke the function. ```powershell -function CD32 {Set-Location -Path c:\windows\system32} +function CD32 {Set-Location -Path C:\windows\system32} Set-Item -Path Alias:go -Value CD32 ``` @@ -313,7 +313,7 @@ Get-Help Get-ChildItem ``` ```powershell -Get-Help Get-ChildItem -Path alias: +Get-Help Get-ChildItem -Path Alias: ``` ## See also diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md index 76d64b67bb82..919d5b3b4297 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arithmetic_Operators.md @@ -227,7 +227,7 @@ following example, the negative value can't be cast to an unsigned integer, and the unsigned integer is too large to be cast to `Int32`: ```powershell -([int32]::minvalue + [uint32]::maxvalue).GetType().FullName +([int32]::MinValue + [uint32]::MaxValue).GetType().FullName ``` ```Output @@ -241,10 +241,10 @@ The `System.Decimal` type is an exception. If either operand has the **Decimal** value is an error. ```powershell -PS> [Decimal]::maxvalue +PS> [decimal]::MaxValue 79228162514264337593543950335 -PS> [Decimal]::maxvalue + 1 +PS> [decimal]::MaxValue + 1 RuntimeException: Value was either too large or too small for a Decimal. ``` @@ -454,12 +454,12 @@ InvalidOperation: A hash table can only be added to another hash table. Although the addition operators are very useful, use the assignment operators to add elements to hash tables and arrays. For more information see -[about_assignment_operators](about_Assignment_Operators.md). The following +[about_Assignment_Operators](about_Assignment_Operators.md). The following examples use the `+=` assignment operator to add items to an array: ```powershell $array = @() -(0..2).foreach{ $array += $_ } +(0..2).ForEach{ $array += $_ } $array ``` @@ -497,7 +497,7 @@ The following examples show how to use the arithmetic operators in expressions with PowerShell commands: ```powershell -(Get-Date) + (New-TimeSpan -day 1) +(Get-Date) + (New-TimeSpan -Day 1) ``` The parenthesis operator forces the evaluation of the `Get-Date` cmdlet and the @@ -505,7 +505,7 @@ evaluation of the `New-TimeSpan -Day 1` cmdlet expression, in that order. Both results are then added using the `+` operator. ```powershell -Get-Process | Where-Object { ($_.ws * 2) -gt 50mb } +Get-Process | Where-Object { ($_.WS * 2) -gt 50mb } ``` ```Output @@ -519,7 +519,7 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName 967 30 58804 59496 416 930.97 2508 WINWORD ``` -In the above expression, each process working space (`$_.ws`) is multiplied by +In the above expression, each process working space (`$_.WS`) is multiplied by `2`; and, the result, compared against `50mb` to see if it's greater than that. ## Bitwise operators @@ -540,7 +540,7 @@ PowerShell supports the following bitwise operators. | `-band` | Bitwise AND | `10 -band 3` | 2 | | `-bor` | Bitwise OR (inclusive) | `10 -bor 3` | 11 | | `-bxor` | Bitwise OR (exclusive) | `10 -bxor 3` | 9 | -| `-bnot` | Bitwise NOT | `-bNot 10` | -11 | +| `-bnot` | Bitwise NOT | `-bnot 10` | -11 | | `-shl` | Shift-left | `102 -shl 2` | 408 | | `-shr` | Shift-right | `102 -shr 1` | 51 | @@ -587,7 +587,7 @@ For example, the binary complement of 0 is -1, the maximum unsigned integer (0xFFFFFFFF), and the binary complement of -1 is 0. ```powershell --bNot 10 +-bnot 10 ``` ```Output diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md index 851033378976..9ecfe8fa992e 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Arrays.md @@ -305,7 +305,7 @@ value in an array, type: ```powershell $a = 0..9 -for ($i = 0; $i -le ($a.length - 1); $i += 2) { +for ($i = 0; $i -le ($a.Length - 1); $i += 2) { $a[$i] } ``` @@ -346,11 +346,11 @@ In PowerShell, arrays have three properties that indicate the number of items contained in the array. - **Count** - This property is the most commonly used property to determine the - number of items in any collection, not just an array. It's an `[Int32]` type + number of items in any collection, not just an array. It's an `[int32]` type value. In Windows PowerShell 5.1 (and older) **Count** alias property for **Length**. -- **Length** - This property is an `[Int32]` type value. This contains the same +- **Length** - This property is an `[int32]` type value. This contains the same value as **Count**. > [!NOTE] @@ -359,7 +359,7 @@ contained in the array. > string is the number of characters in the string. But the **Count** > property is always `1`. -- **Longlength** - This property is an `[Int64]` type value. Use this property +- **LongLength** - This property is an `[int64]` type value. Use this property for arrays containing more than 2,147,483,647 elements. ```powershell @@ -408,8 +408,8 @@ Multidimensional arrays are stored in [row-major order][14]. The following example shows how to create a truly multidimensional array. ```powershell -[string[,]]$rank2 = [string[,]]::New(3,2) -$rank2.rank +[string[,]]$rank2 = [string[,]]::new(3,2) +$rank2.Rank $rank2.Length $rank2[0,0] = 'a' $rank2[0,1] = 'b' @@ -487,7 +487,7 @@ True In this example, `$intA` is explicitly typed to contain integers. ```powershell -[Int[]] $intA = 1, 2, 3 +[int[]] $intA = 1, 2, 3 $intA.Clear() $intA ``` @@ -552,7 +552,7 @@ For more information about the behavior of **ArgumentList**, see The `ForEach()` method can be used to cast the elements to a different type; the following example shows how to convert a list of string dates to -`[DateTime]` type. +`[datetime]` type. ```powershell ("1/1/2017", "2/1/2017", "3/1/2017").ForEach([datetime]) @@ -680,7 +680,7 @@ to return. ```powershell # Get the zip files in the current users profile, sorted by LastAccessTime -$Zips = dir $env:userprofile -Recurse '*.zip' | Sort-Object LastAccessTime +$Zips = dir $Env:USERPROFILE -Recurse '*.zip' | Sort-Object LastAccessTime # Get the least accessed file over 100MB $Zips.Where({$_.Length -gt 100MB}, 'Default', 1) ``` @@ -876,7 +876,7 @@ create the `$t` array with all the elements in the `$a` array except for the value at index position 2, type: ```powershell -$t = $a[0,1 + 3..($a.length - 1)] +$t = $a[0,1 + 3..($a.Length - 1)] ``` To combine two arrays into a single array, use the plus operator (`+`). The @@ -1093,7 +1093,7 @@ LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;} ## See also - [about_For][05] -- [about_ForEach][06] +- [about_Foreach][06] - [about_Hash_Tables][07] - [about_Member-Access_Enumeration][09] - [about_Operators][11] @@ -1106,7 +1106,7 @@ LastWriteTimeUtc Property datetime LastWriteTimeUtc {get;set;} [03]: about_Assignment_Operators.md [04]: about_Booleans.md [05]: about_For.md -[06]: about_ForEach.md +[06]: about_Foreach.md [07]: about_Hash_Tables.md [08]: about_Intrinsic_Members.md [09]: about_Member-Access_Enumeration.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md index 51451fd59a07..ef6fd3636320 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Assignment_Operators.md @@ -82,7 +82,7 @@ pipeline to a variable. For example, the following command sorts the services on the computer and then assigns the sorted services to the `$a` variable: ```powershell -$a = Get-Service | Sort-Object -Property name +$a = Get-Service | Sort-Object -Property Name ``` You can also assign the value created by a statement to a variable, as in the diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md index 0ecc090fcd66..cd4a74bdcb66 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Automatic_Variables.md @@ -204,8 +204,8 @@ non-zero integer. ### `$foreach` -Contains the enumerator (not the resulting values) of a [ForEach][56] loop. The -`$foreach` variable exists only while the `ForEach` loop is running; it's +Contains the enumerator (not the resulting values) of a [foreach][56] loop. The +`$foreach` variable exists only while the `foreach` loop is running; it's deleted after the loop is completed. Enumerators contain properties and methods you can use to retrieve loop values @@ -215,18 +215,18 @@ and change the current loop iteration. For more information, see ### `$HOME` Contains the full path of the user's home directory. This variable uses the -value of the `"$env:USERPROFILE"` Windows environment variable, typically +value of the `"$Env:USERPROFILE"` Windows environment variable, typically `C:\Users\`. > [!IMPORTANT] > Windows can redirect the location of the user's profile. This means that -> `$HOME` may not have the same value as `"$env:HOMEDRIVE$env:HOMEPATH"`. +> `$HOME` may not have the same value as `"$Env:HOMEDRIVE$Env:HOMEPATH"`. ### `$Host` Contains an object that represents the current host application for PowerShell. You can use this variable to represent the current host in commands or to -display or change the properties of the host, such as `$Host.version` or +display or change the properties of the host, such as `$Host.Version` or `$Host.CurrentCulture`, or `$Host.UI.RawUI.BackGroundColor = "Red"`. ### $input @@ -456,7 +456,7 @@ Test-Path $PROFILE Or, you can use it in a command to create a profile: ```powershell -New-Item -ItemType file -Path $PROFILE -Force +New-Item -ItemType File -Path $PROFILE -Force ``` You can use it in a command to open the profile in **notepad.exe**: @@ -550,7 +550,7 @@ available for use in module manifest files, whereas `$PSVersionTable` isn't. ### `$PSHOME` Contains the full path of the installation directory for PowerShell, typically, -`$env:windir\System32\PowerShell\v1.0` in Windows systems. You can use this +`$Env:windir\System32\PowerShell\v1.0` in Windows systems. You can use this variable in the paths of PowerShell files. For example, the following command searches the conceptual Help topics for the word **Help**: @@ -639,8 +639,8 @@ Contains a stack trace for the most recent error. ### `$switch` -Contains the enumerator not the resulting values of a `Switch` statement. The -`$switch` variable exists only while the `Switch` statement is running; it's +Contains the enumerator not the resulting values of a `switch` statement. The +`$switch` variable exists only while the `switch` statement is running; it's deleted when the `switch` statement completes execution. For more information, see [about_Switch][71]. @@ -1093,7 +1093,7 @@ Default (Current): End [53]: about_CommonParameters.md [54]: about_comparison_operators.md [55]: about_Continue.md -[56]: about_ForEach.md +[56]: about_Foreach.md [57]: about_Functions_Advanced_Methods.md [58]: about_Functions_Advanced_Parameters.md [59]: about_Functions_Advanced.md diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Booleans.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Booleans.md index 7f4728630e38..417dbcd6848d 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Booleans.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Booleans.md @@ -90,7 +90,7 @@ Examples: # Empty collections PS> [bool]@() False -PS> [bool](Get-ChildItem | Where-Object Name -eq 'Non-existent-File.txt') +PS> [bool](Get-ChildItem | Where-Object Name -EQ 'Non-existent-File.txt') False # Single-element collections PS> $a = @(0) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md index 12c09bba6b32..bba876d06912 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Calculated_Properties.md @@ -33,76 +33,76 @@ The following list itemizes the cmdlets that support calculated properties and the key-value pairs that each cmdlet supports. - `Compare-Object` - - `expression` + - `Expression` - `ConvertTo-Html` - - `name`/`label` - optional (added in PowerShell 6.x) - - `expression` - - `width` - optional - - `alignment` - optional + - `Name`/`Label` - optional (added in PowerShell 6.x) + - `Expression` + - `Width` - optional + - `Alignment` - optional - `Format-Custom` - - `expression` - - `depth` - optional + - `Expression` + - `Depth` - optional - `Format-List` - - `name`/`label` - optional - - `expression` - - `formatstring` - optional + - `Name`/`Label` - optional + - `Expression` + - `FormatString` - optional This same set of key-value pairs also apply to calculated property values passed to the **GroupBy** parameter for all `Format-*` cmdlets. - `Format-Table` - - `name`/`label` - optional - - `expression` - - `formatstring` - optional - - `width` - optional - - `alignment` - optional + - `Name`/`Label` - optional + - `Expression` + - `FormatString` - optional + - `Width` - optional + - `Alignment` - optional - `Format-Wide` - - `expression` - - `formatstring` - optional + - `Expression` + - `FormatString` - optional - `Group-Object` - - `expression` + - `Expression` - `Measure-Object` - Only supports a script block for the expression, not a hashtable. - Not supported in PowerShell 5.1 and older. - `Select-Object` - - `name`/`label` - optional - - `expression` + - `Name`/`Label` - optional + - `Expression` - `Sort-Object` - - `expression` - - `ascending`/`descending` - optional + - `Expression` + - `Ascending`/`Descending` - optional > [!NOTE] -> The value of the `expression` can be a script block instead of a +> The value of the `Expression` can be a script block instead of a > hashtable. For more information, see the [Notes][02] section. ## Hashtable key definitions -- `name`/`label` - Specifies the name of the property being created. You can - use `name` or its alias, `label`, interchangeably. -- `expression` - A string or script block used to calculate the value of the - new property. If the `expression` is a string, the value is interpreted as a +- `Name`/`Label` - Specifies the name of the property being created. You can + use `Name` or its alias, `Label`, interchangeably. +- `Expression` - A string or script block used to calculate the value of the + new property. If the `Expression` is a string, the value is interpreted as a property name on the input object. This is a shorter option than - `expression = { $_. }`. -- `alignment` - Used by cmdlets that produce tabular output to define how the - values are displayed in a column. The value must be `'left'`, `'center'`, or - `'right'`. -- `formatstring` - Specifies a format string that defines how the value is + `Expression = { $_. }`. +- `Alignment` - Used by cmdlets that produce tabular output to define how the + values are displayed in a column. The value must be `'Left'`, `'Center'`, or + `'Right'`. +- `FormatString` - Specifies a format string that defines how the value is formatted for output. For more information about format strings, see [Format types in .NET][01]. -- `width` - Specifies the maximum width column in a table when the value is +- `Width` - Specifies the maximum width column in a table when the value is displayed. The value must be greater than `0`. -- `depth` - The **Depth** parameter of `Format-Custom` specifies the depth of - expansion for all properties. The `depth` key allows you to specify the +- `Depth` - The **Depth** parameter of `Format-Custom` specifies the depth of + expansion for all properties. The `Depth` key allows you to specify the depth of expansion per property. -- `ascending` / `descending` - Allows you to specify the order of sorting for +- `Ascending` / `Descending` - Allows you to specify the order of sorting for one or more properties. These are boolean values. You don't need to spell out the hashtable keys as long as the specified name @@ -119,7 +119,7 @@ directly, the values are compared to the result of the arithmetic operation (modulus of 2). ```powershell -Compare-Object @{p=1} @{p=2} -property @{ Expression = { $_.p % 2 } } +Compare-Object @{p=1} @{p=2} -Property @{ Expression = { $_.p % 2 } } ``` ```Output @@ -139,8 +139,8 @@ Get-Alias | ConvertTo-Html Name, Definition, @{ - expr={$_.Parameters.Keys.Count} - align='center' + Expr={$_.Parameters.Keys.Count} + Align='Center' } | Out-File .\aliases.htm -Force ``` @@ -154,15 +154,15 @@ the number parameters for each aliased command. The values of `Format-Custom` provides a custom view of an object in a format similar to a class definition. More complex objects can contain members that are deeply nested with complex types. The **Depth** parameter of `Format-Custom` specifies -the depth of expansion for all properties. The `depth` key allows you to +the depth of expansion for all properties. The `Depth` key allows you to specify the depth of expansion per property. -In this example, the `depth` key simplifies the custom output for the +In this example, the `Depth` key simplifies the custom output for the `Get-Date` cmdlet. `Get-Date` returns a **DateTime** object. The **Date** property of this object is also a **DateTime** object, so the object is nested. ```powershell -Get-Date | Format-Custom @{expr={$_.Date};depth=1},TimeOfDay +Get-Date | Format-Custom @{Expr={$_.Date};Depth=1},TimeOfDay ``` ```Output @@ -211,16 +211,16 @@ the output from `Get-ChildItem`. ```powershell Get-ChildItem *.json -File | - Format-List Fullname, + Format-List FullName, @{ - name='Modified' - expression={$_.LastWriteTime} - formatstring='O' + Name='Modified' + Expression={$_.LastWriteTime} + FormatString='O' }, @{ - name='Size' - expression={$_.Length/1KB} - formatstring='N2' + Name='Size' + Expression={$_.Length/1KB} + FormatString='N2' } ``` @@ -245,11 +245,11 @@ classify the files by the content type. ```powershell Get-ChildItem -File | - Sort-Object extension | + Sort-Object Extension | Format-Table Name, Length -GroupBy @{ - name='Type' - expression={ - switch ($_.extension) { + Name='Type' + Expression={ + switch ($_.Extension) { '.md' {'Content'} '' {'Metacontent'} '.ps1' {'Automation'} @@ -311,7 +311,7 @@ value. ```powershell Get-ChildItem -File | - Format-Wide -Property @{e={'{0} ({1:N2}kb)' -f $_.name,($_.length/1kb)}} + Format-Wide -Property @{e={'{0} ({1:N2}kb)' -f $_.Name,($_.Length/1kb)}} ``` ```Output @@ -334,10 +334,10 @@ of files of each content type. ```powershell Get-ChildItem -File | - Sort-Object extension | + Sort-Object Extension | Group-Object -NoElement -Property @{ - expression={ - switch ($_.extension) { + Expression={ + switch ($_.Extension) { '.md' {'Content'} '' {'Metacontent'} '.ps1' {'Automation'} @@ -371,8 +371,8 @@ $aliases = Get-Alias c* | Select-Object Name, Definition, @{ - name='ParameterCount' - expr={$_.Parameters.Keys.Count} + Name='ParameterCount' + Expr={$_.Parameters.Keys.Count} } $aliases | Get-Member $aliases @@ -422,7 +422,7 @@ property. This example sorts data from a CSV file in ascending order by ```powershell Import-Csv C:\temp\sales-data.csv | - Sort-Object Date, @{expr={$_.UnitsSold}; desc=$true}, Salesperson | + Sort-Object Date, @{Expr={$_.UnitsSold}; Desc=$true}, Salesperson | Select-Object Date, Salesperson, UnitsSold ``` diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes.md index 5f92054fd06e..2e214a7917a4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes.md @@ -203,8 +203,8 @@ class BookList { # Static method to initialize the list of books. Called in the other # static methods to avoid needing to explicit initialize the value. static [void] Initialize() { [BookList]::Initialize($false) } - static [bool] Initialize([bool]$force) { - if ([BookList]::Books.Count -gt 0 -and -not $force) { + static [bool] Initialize([bool]$Force) { + if ([BookList]::Books.Count -gt 0 -and -not $Force) { return $false } @@ -527,7 +527,7 @@ module is removed, so are the type accelerators. ## Manually importing classes from a PowerShell module -`Import-Module` and the `#requires` statement only import the module functions, +`Import-Module` and the `#Requires` statement only import the module functions, aliases, and variables, as defined by the module. Classes aren't imported. If a module defines classes and enumerations but doesn't add type accelerators diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md index 623654d78319..2d647f75b452 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Constructors.md @@ -309,7 +309,7 @@ class BaseExample { Write-Verbose "[$($Type.Name)] static constructor" } - static [void] ParamMessage([type]$Type, [object]$Value) { + static [void] ParamMessage([type]$Type, [Object]$Value) { Write-Verbose "[$($Type.Name)] param constructor ($Value)" } diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md index c5acd70baa0f..bbf4122351a7 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Inheritance.md @@ -58,14 +58,14 @@ declaration. This example shows the basic PowerShell class inheritance syntax. ```powershell -Class Derived : Base {...} +class Derived : Base {...} ``` This example shows inheritance with an interface declaration coming after the base class. ```powershell -Class Derived : Base, Interface {...} +class Derived : Base, Interface {...} ``` ## Syntax @@ -657,7 +657,7 @@ Kelvin. For any other format, the method should throw a } # If format provider isn't specified, use the current culture. if ($null -eq $FormatProvider) { - $FormatProvider = [CultureInfo]::CurrentCulture + $FormatProvider = [cultureinfo]::CurrentCulture } # Format the temperature. switch ($Format) { @@ -748,7 +748,7 @@ class Temperature : System.IFormattable { } # If format provider isn't specified, use the current culture. if ($null -eq $FormatProvider) { - $FormatProvider = [CultureInfo]::CurrentCulture + $FormatProvider = [cultureinfo]::CurrentCulture } # Format the temperature. switch ($Format) { @@ -815,7 +815,7 @@ To implement the interface, the class needs to inherit from method needs to have the following signature: ```powershell -[bool] Equals([object]$Other) { +[bool] Equals([Object]$Other) { # Implementation } ``` @@ -830,7 +830,7 @@ values to Kelvin, since temperatures can be equivalent even with different scales. ```powershell -[bool] Equals([object]$Other) { +[bool] Equals([Object]$Other) { # If the other object is null, we can't compare it. if ($null -eq $Other) { return $false @@ -851,7 +851,7 @@ With the interface method implemented, the updated definition for **Temperature** is: ```powershell -class Temperature : System.IFormattable, System.IEquatable[object] { +class Temperature : System.IFormattable, System.IEquatable[Object] { [float] $Degrees [TemperatureScale] $Scale @@ -899,7 +899,7 @@ class Temperature : System.IFormattable, System.IEquatable[object] { } # If format provider isn't specified, use the current culture. if ($null -eq $FormatProvider) { - $FormatProvider = [CultureInfo]::CurrentCulture + $FormatProvider = [cultureinfo]::CurrentCulture } # Format the temperature. switch ($Format) { @@ -927,7 +927,7 @@ class Temperature : System.IFormattable, System.IEquatable[object] { return $this.ToString($null, $null) } - [bool] Equals([object]$Other) { + [bool] Equals([Object]$Other) { # If the other object is null, we can't compare it. if ($null -eq $Other) { return $false @@ -999,7 +999,7 @@ converted to a different scale, is a floating point number, the method can rely on the underlying type for the actual comparison. ```powershell -[int] CompareTo([object]$Other) { +[int] CompareTo([Object]$Other) { # If the other object's null, consider this instance "greater than" it if ($null -eq $Other) { return 1 @@ -1021,7 +1021,7 @@ The final definition for the **Temperature** class is: ```powershell class Temperature : System.IFormattable, System.IComparable, - System.IEquatable[object] { + System.IEquatable[Object] { # Instance properties [float] $Degrees [TemperatureScale] $Scale @@ -1071,7 +1071,7 @@ class Temperature : System.IFormattable, } # If format provider isn't specified, use the current culture. if ($null -eq $FormatProvider) { - $FormatProvider = [CultureInfo]::CurrentCulture + $FormatProvider = [cultureinfo]::CurrentCulture } # Format the temperature. switch ($Format) { @@ -1099,7 +1099,7 @@ class Temperature : System.IFormattable, return $this.ToString($null, $null) } - [bool] Equals([object]$Other) { + [bool] Equals([Object]$Other) { # If the other object is null, we can't compare it. if ($null -eq $Other) { return $false @@ -1112,7 +1112,7 @@ class Temperature : System.IFormattable, # Compare the temperatures as Kelvin. return $this.ToKelvin() -eq $OtherTemperature.ToKelvin() } - [int] CompareTo([object]$Other) { + [int] CompareTo([Object]$Other) { # If the other object's null, consider this instance "greater than" it if ($null -eq $Other) { return 1 @@ -1182,7 +1182,7 @@ generic type as long as the type parameter is already defined at parse time. ```powershell class ExampleStringList : System.Collections.Generic.List[string] {} -$List = [ExampleStringList]::New() +$List = [ExampleStringList]::new() $List.AddRange([string[]]@('a','b','c')) $List.GetType() | Format-List -Property Name, BaseType $List @@ -1243,7 +1243,7 @@ This time, PowerShell doesn't raise any errors. Both classes are now defined. Run the following code block to view the behavior of the new class. ```powershell -$List = [ExampleItemList]::New() +$List = [ExampleItemList]::new() $List.AddRange([ExampleItem[]]@( [ExampleItem]@{ Name = 'Foo' } [ExampleItem]@{ Name = 'Bar' } diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md index f1aea5402bd3..c69f6911cea8 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Classes_Methods.md @@ -602,17 +602,17 @@ class. The representation for **DerivedClassB** is different because it overrode the `ToString()` instance method. ```powershell -"`$base = [BaseClass]::New() => $($base = [BaseClass]::New(); $base)" -"`$a = [DerivedClassA]::New() => $($a = [DerivedClassA]::New(); $a)" -"`$b = [DerivedClassB]::New() => $($b = [DerivedClassB]::New(); $b)" -"`$c = [DerivedClassC]::New() => $($c = [DerivedClassC]::New(); $c)" +"`$base = [BaseClass]::new() => $($base = [BaseClass]::new(); $base)" +"`$a = [DerivedClassA]::new() => $($a = [DerivedClassA]::new(); $a)" +"`$b = [DerivedClassB]::new() => $($b = [DerivedClassB]::new(); $b)" +"`$c = [DerivedClassC]::new() => $($c = [DerivedClassC]::new(); $c)" ``` ```Output -$base = [BaseClass]::New() => 11/6/2023 9:44:57 AM -$a = [DerivedClassA]::New() => 11/6/2023 9:44:57 AM -$b = [DerivedClassB]::New() => 2023-11-06 -$c = [DerivedClassC]::New() => 11/6/2023 9:44:57 AM +$base = [BaseClass]::new() => 11/6/2023 9:44:57 AM +$a = [DerivedClassA]::new() => 11/6/2023 9:44:57 AM +$b = [DerivedClassB]::new() => 2023-11-06 +$c = [DerivedClassC]::new() => 11/6/2023 9:44:57 AM ``` The next block calls the `SetTimeStamp()` instance method for each instance, diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md index b4bf6a8ec63c..9815983d7e4e 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Precedence.md @@ -38,7 +38,7 @@ C:\TechDocs\FindDocs.ps1 You can run any executable command using its full path. As a security feature, PowerShell doesn't run executable commands, including PowerShell scripts and native commands, unless the command is located in a path listed in the -`$env:Path` environment variable. +`$Env:PATH` environment variable. To run an executable file that's in the current directory, specify the full path or use the relative path `.\` to represent the current directory. @@ -58,7 +58,7 @@ when it runs commands. 1. External executable files (including PowerShell script files) Therefore, if you type `help`, PowerShell first looks for an alias named -`help`, then a function named `Help`, and finally a cmdlet named `Help`. It +`help`, then a function named `help`, and finally a cmdlet named `help`. It runs the first `help` item that it finds. For example, if your session contains a cmdlet and a function, both named @@ -247,7 +247,7 @@ For example, the following command saves the `Map` function in the `$myMap` variable and then uses the `Call` operator to run it. ```powershell -$myMap = (Get-Command -Name map -CommandType function) +$myMap = (Get-Command -Name map -CommandType Function) & ($myMap) ``` @@ -273,7 +273,7 @@ first module found alphabetically. If the cmdlet isn't loaded, PowerShell searches the installed modules and autoloads the first module that contains the cmdlet and runs that cmdlet. -PowerShell searches for modules in each path defined in the `$env:PSModulePath` +PowerShell searches for modules in each path defined in the `$Env:PSModulePath` environment variable. The paths are searched in the order that they're listed in the variable. Within each path, the modules are searched in alphabetical order. PowerShell uses the cmdlet from the first match it finds. @@ -299,7 +299,7 @@ Import-Module -Name DateFunctions -Prefix ZZ ## Running external executables -On Windows. PowerShell treats the file extensions listed in the `$env:PATHEXT` +On Windows. PowerShell treats the file extensions listed in the `$Env:PATHEXT` environment variable as executable files. Files that aren't Windows executables are handed to Windows to process. Windows looks up the file association and executes the default Windows Shell verb for the extension. For Windows to @@ -312,7 +312,7 @@ to register the file handler. For more information, see the documentation for the [ftype][04] command. For PowerShell to see a file extension as executable in the current session, -you must add the extension to the `$env:PATHEXT` environment variable. +you must add the extension to the `$Env:PATHEXT` environment variable. ## See also diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md index 967c145301d1..f1b2f6f0efbb 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comment_Based_Help.md @@ -70,12 +70,12 @@ Keywords define each section of comment-based help. Each comment-based help keyword is preceded by a dot `.`. The keywords can appear in any order. The keyword names aren't case-sensitive. -For example, the `.Description` keyword precedes a description of a function or +For example, the `.DESCRIPTION` keyword precedes a description of a function or script. ```powershell <# -.Description +.DESCRIPTION Get-Function displays the name and syntax of all functions in the session. #> ``` @@ -220,8 +220,8 @@ ignored. function Verb-Noun { [CmdletBinding()] param ( - # This is the same as .Parameter - [string]$Computername + # This is the same as .PARAMETER + [string]$ComputerName ) # Verb the Noun on the computer } @@ -256,7 +256,7 @@ Repeat the `.LINK` keyword for each related topic. This content appears in the Related Links section of the help topic. -The `.Link` keyword content can also include a Uniform Resource Identifier +The `.LINK` keyword content can also include a Uniform Resource Identifier (URI) to an online version of the same help topic. The online version opens when you use the **Online** parameter of `Get-Help`. The URI must begin with "http" or "https". @@ -290,7 +290,7 @@ provider. ### .FORWARDHELPCATEGORY -Specifies the help category of the item in `.ForwardHelpTargetName`. Valid +Specifies the help category of the item in `.FORWARDHELPTARGETNAME`. Valid values are `Alias`, `Cmdlet`, `HelpFile`, `Function`, `Provider`, `General`, `FAQ`, `Glossary`, `ScriptCommand`, `ExternalScript`, `Filter`, or `All`. Use this keyword to avoid conflicts when there are commands with the same name. @@ -369,11 +369,11 @@ type, the **Object** type is inserted as the default value. ### Parameter List The parameter list in the help topic is generated from the function or script -syntax and from the descriptions that you add by using the `.Parameter` +syntax and from the descriptions that you add by using the `.PARAMETER` keyword. The function parameters appear in the **Parameters** section of the help topic in the same order that they appear in the function or script syntax. The spelling and capitalization of parameter names is also taken from the -syntax. It isn't affected by the parameter name specified by the `.Parameter` +syntax. It isn't affected by the parameter name specified by the `.PARAMETER` keyword. ### Common Parameters @@ -408,8 +408,8 @@ The following sample function includes comment-based help: function Add-Extension { param ([string]$Name,[string]$Extension = "txt") -$name = $name + "." + $extension -$name +$Name = $Name + "." + $Extension +$Name <# .SYNOPSIS @@ -438,17 +438,17 @@ or file name. .EXAMPLE -PS> extension -name "File" +PS> Add-Extension -Name "File" File.txt .EXAMPLE -PS> extension -name "File" -extension "doc" +PS> Add-Extension -Name "File" -Extension "doc" File.doc .EXAMPLE -PS> extension "File" "doc" +PS> Add-Extension "File" "doc" File.doc .LINK @@ -511,7 +511,7 @@ Accept wildcard characters? This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer and -OutVariable. For more information, type -"get-help about_commonparameters". +"Get-Help about_CommonParameters". INPUTS None. You can't pipe objects to Add-Extension. @@ -523,17 +523,17 @@ file name. Example 1 -PS> extension -name "File" +PS> Add-Extension -Name "File" File.txt Example 2 -PS> extension -name "File" -extension "doc" +PS> Add-Extension -Name "File" -Extension "doc" File.doc Example 3 -PS> extension "File" "doc" +PS> Add-Extension "File" "doc" File.doc RELATED LINKS @@ -556,15 +556,15 @@ param [string] #Specifies the file name. -$name, +$Name, [string] #Specifies the file name extension. "Txt" is the default. -$extension = "txt" +$Extension = "txt" ) -$name = $name + "." + $extension -$name +$Name = $Name + "." + $Extension +$Name <# .SYNOPSIS @@ -587,17 +587,17 @@ file name. .EXAMPLE -PS> extension -name "File" +PS> Add-Extension -Name "File" File.txt .EXAMPLE -PS> extension -name "File" -extension "doc" +PS> Add-Extension -Name "File" -Extension "doc" File.doc .EXAMPLE -PS> extension "File" "doc" +PS> Add-Extension "File" "doc" File.doc .LINK @@ -614,8 +614,8 @@ Set-Item ### Comment-based Help for a Script The following sample script includes comment-based help. Notice the blank lines -between the closing `#>` and the `Param` statement. In a script that doesn't -have a `Param` statement, there must be at least two blank lines between the +between the closing `#>` and the `param` statement. In a script that doesn't +have a `param` statement, there must be at least two blank lines between the final comment in the help topic and the first function declaration. Without these blank lines, `Get-Help` associates the help topic with the function, not the script. @@ -653,22 +653,22 @@ PS> .\Update-Month.ps1 .EXAMPLE -PS> .\Update-Month.ps1 -inputpath C:\Data\January.csv +PS> .\Update-Month.ps1 -InputPath C:\Data\January.csv .EXAMPLE -PS> .\Update-Month.ps1 -inputpath C:\Data\January.csv -outputPath ` +PS> .\Update-Month.ps1 -InputPath C:\Data\January.csv -OutputPath ` C:\Reports\2009\January.csv #> -param ([string]$InputPath, [string]$OutPutPath) +param ([string]$InputPath, [string]$OutputPath) function Get-Data { } ... ``` The following command gets the script help. Because the script isn't in a -directory that's listed in the `$env:Path` environment variable, the +directory that's listed in the `$Env:PATH` environment variable, the `Get-Help` command that gets the script help must specify the script path. ```powershell @@ -720,7 +720,7 @@ Accept wildcard characters? This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer and -OutVariable. For more information, type, -"get-help about_commonparameters". +"Get-Help about_CommonParameters". # INPUTS @@ -736,11 +736,11 @@ PS> .\Update-Month.ps1 Example 2 -PS> .\Update-Month.ps1 -inputpath C:\Data\January.csv +PS> .\Update-Month.ps1 -InputPath C:\Data\January.csv Example 3 -PS> .\Update-Month.ps1 -inputpath C:\Data\January.csv -outputPath +PS> .\Update-Month.ps1 -InputPath C:\Data\January.csv -OutputPath C:\Reports\2009\January.csv # RELATED LINKS @@ -762,7 +762,7 @@ the keyword. Any other placement is ineffective. ```powershell # .EXTERNALHELP C:\MyScripts\Update-Month-Help.xml -param ([string]$InputPath, [string]$OutPutPath) +param ([string]$InputPath, [string]$OutputPath) function Get-Data { } ... ``` @@ -774,17 +774,17 @@ keyword in a function. function Add-Extension { # .EXTERNALHELP C:\ps-test\Add-Extension.xml - param ([string] $name, [string]$extension = "txt") - $name = $name + "." + $extension - $name + param ([string] $Name, [string]$Extension = "txt") + $Name = $Name + "." + $Extension + $Name } ``` ```powershell function Add-Extension { - param ([string] $name, [string]$extension = "txt") - $name = $name + "." + $extension - $name + param ([string] $Name, [string]$Extension = "txt") + $Name = $Name + "." + $Extension + $Name # .EXTERNALHELP C:\ps-test\Add-Extension.xml } @@ -793,9 +793,9 @@ function Add-Extension { ```powershell # .EXTERNALHELP C:\ps-test\Add-Extension.xml function Add-Extension { - param ([string] $name, [string]$extension = "txt") - $name = $name + "." + $extension - $name + param ([string] $Name, [string]$Extension = "txt") + $Name = $Name + "." + $Extension + $Name } ``` @@ -804,7 +804,7 @@ function Add-Extension { The following code is an excerpt from the beginning of the built-in help function in PowerShell, which displays one screen of help text at a time. Because the help topic for the `Get-Help` cmdlet describes the help function, -the help function uses the `.ForwardHelpTargetName` and `.ForwardHelpCategory` +the help function uses the `.FORWARDHELPTARGETNAME` and `.FORWARDHELPCATEGORY` keywords to redirect the user to the `Get-Help` cmdlet help topic. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md index a31be4719af9..e7b7ebcafff1 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comments.md @@ -162,7 +162,7 @@ before the script is executed. # SIG # End signature block ``` -For more information, see [about_signing][10]. +For more information, see [about_Signing][10]. ### Code editor region markers diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md index 69316a926fbf..ee9f96ee06ef 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_CommonParameters.md @@ -350,7 +350,7 @@ For example, the following command creates the `$out` variable and stores the process object in it: ```powershell -Get-Process PowerShell -OutVariable out +Get-Process powershell -OutVariable out ``` The following command adds the process object to the `$out` variable: @@ -419,13 +419,13 @@ Valid values are strings, the same as for any variable names. > a command after the blocking command. The following is an example of how **PipelineVariable** works. In this example, -the **PipelineVariable** parameter is added to a `Foreach-Object` command to +the **PipelineVariable** parameter is added to a `ForEach-Object` command to store the results of the command in variables. A range of numbers, 1 to 5, are -piped into the first `Foreach-Object` command, the results of which are stored +piped into the first `ForEach-Object` command, the results of which are stored in a variable named `$temp`. -The results of the first `Foreach-Object` command are piped into a second -`Foreach-Object` command, which displays the current values of `$temp` and +The results of the first `ForEach-Object` command are piped into a second +`ForEach-Object` command, which displays the current values of `$temp` and `$_`. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md index 4739521aaa22..f26bb1eff49a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Comparison_Operators.md @@ -162,8 +162,8 @@ The following example demonstrates the issue. ```powershell class MyFileInfoSet { - [String]$File - [Int64]$Size + [string]$File + [int64]$Size } $a = [MyFileInfoSet]@{File = "C:\Windows\explorer.exe"; Size = 4651032} $b = [MyFileInfoSet]@{File = "C:\Windows\explorer.exe"; Size = 4651032} @@ -184,8 +184,8 @@ the File and Size properties of two **MyFileInfoSet** objects are the same. ```powershell class MyFileInfoSet : System.IEquatable[Object] { - [String]$File - [Int64]$Size + [string]$File + [int64]$Size [bool] Equals([Object] $obj) { return ($this.File -eq $obj.File) -and ($this.Size -eq $obj.Size) @@ -319,7 +319,7 @@ Examples: ```powershell # Date comparison -[DateTime]'2001-11-12' -lt [DateTime]'2020-08-01' # True +[datetime]'2001-11-12' -lt [datetime]'2020-08-01' # True # Sorting order comparison 'a' -lt 'z' # True; 'a' comes before 'z' @@ -505,7 +505,7 @@ such as renaming files. For example, the following command changes the file name extensions of all `.txt` files to `.log`: ```powershell -Get-ChildItem *.txt | Rename-Item -NewName { $_.name -replace '\.txt$','.log' } +Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace '\.txt$','.log' } ``` By default, the `-replace` operator is case-insensitive. To make it case @@ -733,7 +733,7 @@ $a -isnot $b.GetType() # Output: True - [about_Regular_Expressions][10] - [about_Wildcards][11] - [Compare-Object][14] -- [Foreach-Object][12] +- [ForEach-Object][12] - [Where-Object][13] diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Core_Commands.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Core_Commands.md index bd504d727a29..99e217b7ba94 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Core_Commands.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Core_Commands.md @@ -19,7 +19,7 @@ PowerShell includes a set of cmdlets that are specifically designed to manage the items in the data stores that are exposed by Windows PowerShell providers. You can use these cmdlets in the same ways to manage all the different types of data that the providers make available to you. For more information about -providers, type "get-help about_providers". +providers, type "Get-Help about_Providers". For example, you can use the Get-ChildItem cmdlet to list the files in a file system directory, the keys under a registry key, or the items that are exposed @@ -87,7 +87,7 @@ PSProvider cmdlets - Get-PSProvider -For more information about a cmdlet, type `get-help `. +For more information about a cmdlet, type `Get-Help `. ## See also diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md index 052731dcb306..4008bd891bcc 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Files.md @@ -1,5 +1,5 @@ --- -description: Describes how to use PowerShell data (.psd1) files. +description: Describes how to use PowerShell data (`.psd1`) files. Locale: en-US ms.date: 01/19/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_data_files?view=powershell-5.1&WT.mc_id=ps-gethelp @@ -55,7 +55,7 @@ you aren't limited to storing string data and don't have to use the data for localized output. The data in the file isn't limited to hashtables. It can be in any format -supported by the PowerShell syntax, such as `DATA` sections. +supported by the PowerShell syntax, such as `data` sections. For more information, see [about_Data_Sections][01]. diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md index 06006bf0e140..b285bb96135f 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Data_Sections.md @@ -10,14 +10,14 @@ title: about_Data_Sections ## Short description -Explains `DATA` sections, which isolate text strings and other read-only +Explains `data` sections, which isolate text strings and other read-only data from script logic. ## Long description -Scripts that are designed for PowerShell can have one or more `DATA` sections -that contain only data. You can include one or more `DATA` sections in any -script, function, or advanced function. The content of the `DATA` section is +Scripts that are designed for PowerShell can have one or more `data` sections +that contain only data. You can include one or more `data` sections in any +script, function, or advanced function. The content of the `data` section is restricted to a specified subset of the PowerShell scripting language. Separating data from code logic makes it easier to identify and manage both @@ -25,27 +25,27 @@ logic and data. It lets you have separate string resource files for text, such as error messages and Help strings. It also isolates the code logic, which facilitates security and validation tests. -In PowerShell, you can use the `DATA` section to support script -internationalization. You can use `DATA` sections to make it easier to isolate, +In PowerShell, you can use the `data` section to support script +internationalization. You can use `data` sections to make it easier to isolate, locate, and process strings that can be translated into other languages. -The `DATA` section was added in PowerShell 2.0 feature. +The `data` section was added in PowerShell 2.0 feature. ### Syntax -The syntax for a `DATA` section is as follows: +The syntax for a `data` section is as follows: ```Syntax -DATA [] [-supportedCommand ] { +data [] [-SupportedCommand ] { } ``` -The `DATA` keyword is required. It isn't case-sensitive. The permitted content +The `data` keyword is required. It isn't case-sensitive. The permitted content is limited to the following elements: - All PowerShell operators, except `-match` -- `If`, `Else`, and `ElseIf` statements +- `if`, `else`, and `elseif` statements - The following automatic variables: `$PSCulture`, `$PSUICulture`, `$true`, `$false`, and `$null` - Comments @@ -60,17 +60,17 @@ is limited to the following elements: "PowerShell 2.0" @( "red", "green", "blue" ) @{ a = 0x1; b = "great"; c ="script" } - [XML] @' + [xml] @'

Hello, World

'@ ``` -- Cmdlets that are permitted in a `DATA` section. By default, only the +- Cmdlets that are permitted in a `data` section. By default, only the `ConvertFrom-StringData` cmdlet is permitted. -- Cmdlets that you permit in a `DATA` section by using the `-SupportedCommand` +- Cmdlets that you permit in a `data` section by using the `-SupportedCommand` parameter. -When you use the `ConvertFrom-StringData` cmdlet in a `DATA` section, you can +When you use the `ConvertFrom-StringData` cmdlet in a `data` section, you can enclose the key-value pairs in single-quoted or double-quoted strings or in single-quoted or double-quoted here-strings. However, strings that contain variables and subexpressions must be enclosed in single-quoted strings or in @@ -81,34 +81,34 @@ subexpressions aren't executable. The **SupportedCommand** parameter allows you to indicate that a cmdlet or function generates only data. It's designed to allow users to include cmdlets -and functions in a `DATA` section that they have written or tested. +and functions in a `data` section that they have written or tested. The value of **SupportedCommand** is a comma-separated list of one or more cmdlet or function names. -For example, the following `DATA` section includes a user-written cmdlet, +For example, the following `data` section includes a user-written cmdlet, `Format-Xml`, that formats data in an XML file: ```powershell -DATA -supportedCommand Format-Xml +data -SupportedCommand Format-Xml { Format-Xml -Strings string1, string2, string3 } ``` -### Using a `DATA` Section +### Using a `data` Section -To use the content of a `DATA` section, assign it to a variable and use +To use the content of a `data` section, assign it to a variable and use variable notation to access the content. -For example, the following `DATA` section contains a `ConvertFrom-StringData` +For example, the following `data` section contains a `ConvertFrom-StringData` command that converts the here-string into a hash table. The hash table is assigned to the `$TextMsgs` variable. -The `$TextMsgs` variable isn't part of the `DATA` section. +The `$TextMsgs` variable isn't part of the `data` section. ```powershell -$TextMsgs = DATA { +$TextMsgs = data { ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 @@ -124,11 +124,11 @@ $TextMsgs.Text001 $TextMsgs.Text002 ``` -Alternately, you can put the variable name in the definition of the `DATA` +Alternately, you can put the variable name in the definition of the `data` section. For example: ```powershell -DATA TextMsgs { +data TextMsgs { ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 @@ -152,7 +152,7 @@ Text002 Windows Server 2008 R2 Simple data strings. ```powershell -DATA { +data { "Thank you for using my PowerShell Organize.pst script." "It is provided free of charge to the community." "I appreciate your comments and feedback." @@ -162,9 +162,9 @@ DATA { Strings that include permitted variables. ```powershell -DATA { +data { if ($null) { - "To get help for this cmdlet, type get-help new-dictionary." + "To get help for this cmdlet, type Get-Help New-Dictionary." } } ``` @@ -172,7 +172,7 @@ DATA { A single-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell -DATA { +data { ConvertFrom-StringData -StringData @' Text001 = Windows 7 Text002 = Windows Server 2008 R2 @@ -183,7 +183,7 @@ Text002 = Windows Server 2008 R2 A double-quoted here-string that uses the `ConvertFrom-StringData` cmdlet: ```powershell -DATA { +data { ConvertFrom-StringData -StringData @" Msg1 = To start, press any key. Msg2 = To exit, type "quit". @@ -194,7 +194,7 @@ Msg2 = To exit, type "quit". A data section that includes a user-written cmdlet that generates data: ```powershell -DATA -supportedCommand Format-XML { +data -SupportedCommand Format-Xml { Format-Xml -Strings string1, string2, string3 } ``` diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md index 1b637fa96b80..a46b486c7328 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Debuggers.md @@ -96,7 +96,7 @@ menu. you are debugging a job by running the `Debug-Job` cmdlet, the `Exit` command detaches the debugger, and allows the job to continue running. -- `k`, `Get-PsCallStack`: Displays the current call stack. +- `k`, `Get-PSCallStack`: Displays the current call stack. - ``: Repeats the last command if it was `Step` (`s`), `StepOver` (`v`), or `List` (`l`). Otherwise, represents a submit action. @@ -308,7 +308,7 @@ sections, the debugger breaks at the first line of each section. For example: ```powershell -function test-cmdlet { +function Test-Cmdlet { begin { Write-Output "Begin" } @@ -320,32 +320,32 @@ function test-cmdlet { } } -C:\PS> Set-PSBreakpoint -Command test-cmdlet +C:\PS> Set-PSBreakpoint -Command Test-Cmdlet -C:\PS> test-cmdlet +C:\PS> Test-Cmdlet Begin Entering debug mode. Use h or ? for help. -Hit Command breakpoint on 'prompt:test-cmdlet' +Hit Command breakpoint on 'prompt:Test-Cmdlet' -test-cmdlet +Test-Cmdlet [DBG]: C:\PS> c Process Entering debug mode. Use h or ? for help. -Hit Command breakpoint on 'prompt:test-cmdlet' +Hit Command breakpoint on 'prompt:Test-Cmdlet' -test-cmdlet +Test-Cmdlet [DBG]: C:\PS> c End Entering debug mode. Use h or ? for help. -Hit Command breakpoint on 'prompt:test-cmdlet' +Hit Command breakpoint on 'prompt:Test-Cmdlet' -test-cmdlet +Test-Cmdlet [DBG]: C:\PS> ``` @@ -436,7 +436,7 @@ function psversion { "Upgrade to PowerShell 7!" } else { - "Have you run a background job today (start-job)?" + "Have you run a background job today (Start-Job)?" } } @@ -545,7 +545,7 @@ steps to the next statement in the script. ```powershell DBG> o Windows PowerShell 2.0 -Have you run a background job today (start-job)? +Have you run a background job today (Start-Job)? test.ps1:13 "Done $scriptName" ``` @@ -562,9 +562,9 @@ indicates that the debugger has exited and returned control to the command processor. Now, run the debugger again. First, to delete the current breakpoint, use the -`Get-PsBreakpoint` and `Remove-PsBreakpoint` cmdlets. (If you think you might -reuse the breakpoint, use the `Disable-PsBreakpoint` cmdlet instead of -`Remove-PsBreakpoint`.) +`Get-PSBreakpoint` and `Remove-PSBreakpoint` cmdlets. (If you think you might +reuse the breakpoint, use the `Disable-PSBreakpoint` cmdlet instead of +`Remove-PSBreakpoint`.) ```powershell PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint @@ -638,7 +638,7 @@ displayed, but it isn't executed. ```powershell DBG> v Windows PowerShell 2.0 -Have you run a background job today (start-job)? +Have you run a background job today (Start-Job)? test.ps1:13 "Done $scriptName" ``` @@ -652,7 +652,7 @@ the standard command prompt. C:\ps-test> ``` -To delete the breakpoints, use the `Get-PsBreakpoint` and `Remove-PsBreakpoint` +To delete the breakpoints, use the `Get-PSBreakpoint` and `Remove-PSBreakpoint` cmdlets. ```powershell @@ -688,13 +688,13 @@ the breakpoint or to perform preparatory or diagnostic tasks, such as starting a log or invoking a diagnostic or security script. To set an action, use a Continue command (c) to exit the script, and a -`Remove-PsBreakpoint` command to delete the current breakpoint. (Breakpoints +`Remove-PSBreakpoint` command to delete the current breakpoint. (Breakpoints are read-only, so you can't add an action to the current breakpoint.) ```powershell DBG> c Windows PowerShell 2.0 -Have you run a background job today (start-job)? +Have you run a background job today (Start-Job)? Done C:\ps-test\test.ps1 PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint @@ -741,7 +741,7 @@ Because the execution policy is set to **RemoteSigned**, execution stops at the function call. At this point, you might want to check the call stack. Use the -`Get-PsCallStack` cmdlet or the `Get-PsCallStack` debugger command (`k`). The +`Get-PSCallStack` cmdlet or the `Get-PSCallStack` debugger command (`k`). The following command gets the current call stack. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_DesiredStateConfiguration.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_DesiredStateConfiguration.md index 1ecaf0fdde98..1a508d4a049e 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_DesiredStateConfiguration.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_DesiredStateConfiguration.md @@ -92,7 +92,7 @@ have defined (two in the example above). For example, in this case: ```powershell MyWebConfig -MachineName "TestMachine" -WebsiteFilePath ` - "\\filesrv\WebFiles" -OutputPath "C:\Windows\system32\temp" + "\\filesrv\WebFiles" -OutputPath "C:\Windows\system32\Temp" # OutputPath is optional ``` @@ -103,7 +103,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.1/Microsoft.PowerShell.Core/About/about_Do.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md index ef94c7e8cdd2..cdcb94c067f8 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Do.md @@ -1,5 +1,5 @@ --- -description: Runs a statement list one or more times, subject to a While or Until condition. +description: Runs a statement list one or more times, subject to a `while` or `until` condition. Locale: en-US ms.date: 06/10/2021 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_do?view=powershell-5.1&WT.mc_id=ps-gethelp @@ -9,24 +9,24 @@ title: about_Do # about_Do ## Short description -Runs a statement list one or more times, subject to a `While` or `Until` +Runs a statement list one or more times, subject to a `while` or `until` condition. ## Long description -The `Do` keyword works with the `While` keyword or the `Until` keyword to run +The `do` keyword works with the `while` keyword or the `until` keyword to run the statements in a script block, subject to a condition. Unlike the related -`While` loop, the script block in a `Do` loop always runs at least once. +`while` loop, the script block in a `do` loop always runs at least once. -A **Do-While** loop is a variety of the `While` loop. In a **Do-While** loop, -the condition is evaluated after the script block has run. As in a While loop, -the script block is repeated as long as the condition evaluates to true. +A **Do-While** loop is a variety of the `while` loop. In a **Do-While** loop, +the condition is evaluated after the script block has run. As in a `while` +loop, the script block is repeated as long as the condition evaluates to true. Like a **Do-While** loop, a **Do-Until** loop always runs at least once before the condition is evaluated. However, the script block runs only while the condition is false. -The `Continue` and `Break` flow control keywords can be used in a **Do-While** +The `continue` and `break` flow control keywords can be used in a **Do-While** loop or in a **Do-Until** loop. ### Syntax @@ -52,7 +52,7 @@ information about how booleans are evaluated, see ### Example -The following example of a `Do` statement counts the items in an array until it +The following example of a `do` statement counts the items in an array until it reaches an item with a value of 0. ```powershell @@ -62,7 +62,7 @@ PS> $count 3 ``` -The following example uses the `Until` keyword. Notice that the not equal to +The following example uses the `until` keyword. Notice that the not equal to operator (`-ne`) is replaced by the equal to operator (`-eq`). ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md index dfef0d01190c..2271ee6ad7c5 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Enum.md @@ -45,7 +45,7 @@ Enumerations use the following syntaxes: ### Flag enumeration definition syntax ```Syntax -[[]...] [Flag()] enum [ : ] { +[[]...] [Flags()] enum [ : ] {