diff --git a/reference/docs-conceptual/security/app-control/application-control.md b/reference/docs-conceptual/security/app-control/application-control.md index 5ee6aaed3460..0813dc588b60 100644 --- a/reference/docs-conceptual/security/app-control/application-control.md +++ b/reference/docs-conceptual/security/app-control/application-control.md @@ -23,8 +23,8 @@ doesn't have way to query the policy enforcement status. To detect if a system w control policy is being enforced by AppLocker, PowerShell creates two temporary files and tests if they can be executed. The filenames use the following name format: -- `$env:TEMP/__PSAppLockerTest__.ps1` -- `$env:TEMP/__PSAppLockerTest__.psm1` +- `$Env:TEMP/__PSAppLockerTest__.ps1` +- `$Env:TEMP/__PSAppLockerTest__.psm1` App Control for Business is the preferred application control system for Windows. App Control provides APIs that allow you to discover the policy configuration. App Control is designed as a diff --git a/reference/docs-conceptual/security/app-control/how-to-use-app-control.md b/reference/docs-conceptual/security/app-control/how-to-use-app-control.md index 1042b978e53c..314db3c88e91 100644 --- a/reference/docs-conceptual/security/app-control/how-to-use-app-control.md +++ b/reference/docs-conceptual/security/app-control/how-to-use-app-control.md @@ -63,16 +63,16 @@ For testing, you just need to create a default policy and a self signed code sig ```powershell $newSelfSignedCertificateSplat = @{ - DnsName = $env:COMPUTERNAME + DnsName = $Env:COMPUTERNAME CertStoreLocation = "Cert:\CurrentUser\My\" Type = 'CodeSigningCert' } $cert = New-SelfSignedCertificate @newSelfSignedCertificateSplat - Export-Certificate -Cert $cert -FilePath c:\certs\signing.cer + Export-Certificate -Cert $cert -FilePath C:\certs\signing.cer Import-Certificate -FilePath C:\certs\signing.cer -CertStoreLocation "Cert:\CurrentUser\Root\" $cert = Get-ChildItem Cert:\CurrentUser\My\ -CodeSigningCert - dir c:\bin\powershell\pwsh.exe | Set-AuthenticodeSignature -Certificate $cert + dir C:\bin\PowerShell\pwsh.exe | Set-AuthenticodeSignature -Certificate $cert ``` 1. Add the code signing certificate to the policy @@ -80,7 +80,7 @@ For testing, you just need to create a default policy and a self signed code sig Use the following command to add the new code signing certificate to the policy. ```powershell - Add-SignerRule -FilePath .\SystemCIPolicy.xml -CertificatePath c:\certs\signing.cer -User + Add-SignerRule -FilePath .\SystemCIPolicy.xml -CertificatePath C:\certs\signing.cer -User ``` 1. Convert the XML policy file to a policy enforcement binary file @@ -134,7 +134,7 @@ events. ```powershell Get-WinEvent -LogName PowerShellCore/Analytic -Oldest | - Where-Object Id -eq 16387 | Format-List + Where-Object Id -EQ 16387 | Format-List ``` ```Output diff --git a/reference/docs-conceptual/security/preventing-script-injection.md b/reference/docs-conceptual/security/preventing-script-injection.md index cd2f57146f14..d749ae453a85 100644 --- a/reference/docs-conceptual/security/preventing-script-injection.md +++ b/reference/docs-conceptual/security/preventing-script-injection.md @@ -202,7 +202,7 @@ You can use this to automate security analysis during builds, continuous integra deployments, and other scenarios. ```powershell -$RulePath = (Get-Module -list InjectionHunter).Path +$RulePath = (Get-Module -List InjectionHunter).Path Invoke-ScriptAnalyzer -CustomRulePath $RulePath -Path .\Invoke-Dangerous.ps1 ``` diff --git a/reference/docs-conceptual/security/remoting/PS-remoting-second-hop.md b/reference/docs-conceptual/security/remoting/PS-remoting-second-hop.md index fb9943feb362..a85a168ead12 100644 --- a/reference/docs-conceptual/security/remoting/PS-remoting-second-hop.md +++ b/reference/docs-conceptual/security/remoting/PS-remoting-second-hop.md @@ -148,7 +148,7 @@ Now let's set up the variables we'll use to represent the servers: ```powershell # Set up variables for reuse -$ServerA = $env:COMPUTERNAME +$ServerA = $Env:COMPUTERNAME $ServerB = Get-ADComputer -Identity ServerB $ServerC = Get-ADComputer -Identity ServerC ``` @@ -202,14 +202,14 @@ $cred = Get-Credential Contoso\Alice # Test kerberos double hop Invoke-Command -ComputerName $ServerB.Name -Credential $cred -ScriptBlock { - Test-Path \\$($using:ServerC.Name)\C$ - Get-Process lsass -ComputerName $($using:ServerC.Name) - Get-EventLog -LogName System -Newest 3 -ComputerName $($using:ServerC.Name) + Test-Path \\$($Using:ServerC.Name)\C$ + Get-Process lsass -ComputerName $($Using:ServerC.Name) + Get-EventLog -LogName System -Newest 3 -ComputerName $($Using:ServerC.Name) } ``` -In this example, the `$using` variable is used to make the `$ServerC` variable visible to _ServerB_. -For more information about the `$using` variable, see [about_Remote_Variables][06]. +In this example, the `Using:` scope modifier is used to make the `$ServerC` variable visible to +_ServerB_. For more information about the `Using:` scope modifier, see [about_Remote_Variables][06]. To allow multiple servers to delegate credentials to _ServerC_, set the value of the **PrincipalsAllowedToDelegateToAccount** parameter on _ServerC_ to an array: diff --git a/reference/docs-conceptual/security/remoting/Running-Remote-Commands.md b/reference/docs-conceptual/security/remoting/Running-Remote-Commands.md index 5ca07091d32c..0365446ce155 100644 --- a/reference/docs-conceptual/security/remoting/Running-Remote-Commands.md +++ b/reference/docs-conceptual/security/remoting/Running-Remote-Commands.md @@ -109,7 +109,7 @@ For example, the following command runs the `DiskCollect.ps1` script on the remo Server01 and Server02. ```powershell -Invoke-Command -ComputerName Server01, Server02 -FilePath c:\Scripts\DiskCollect.ps1 +Invoke-Command -ComputerName Server01, Server02 -FilePath C:\Scripts\DiskCollect.ps1 ``` ### Establish a Persistent Connection @@ -149,11 +149,11 @@ PowerShell includes cmdlets that allow you to: - Import commands from a remote session that actually run implicitly on the remote session - Configure the security of a remote session -PowerShell on Windows includes a WSMan provider. The provider creates a `WSMAN:` drive that lets you +PowerShell on Windows includes a WSMan provider. The provider creates a `WSMan:` drive that lets you navigate through a hierarchy of configuration settings on the local computer and remote computers. For more information about the WSMan provider, see [WSMan Provider][07] and -[About WS-Management Cmdlets][06], or in the Windows PowerShell console, type `Get-Help wsman`. +[About WS-Management Cmdlets][06], or in the Windows PowerShell console, type `Get-Help WSMan`. For more information, see: diff --git a/reference/docs-conceptual/security/remoting/SSH-Remoting-in-PowerShell.md b/reference/docs-conceptual/security/remoting/SSH-Remoting-in-PowerShell.md index 10774406482b..28274c653103 100644 --- a/reference/docs-conceptual/security/remoting/SSH-Remoting-in-PowerShell.md +++ b/reference/docs-conceptual/security/remoting/SSH-Remoting-in-PowerShell.md @@ -68,7 +68,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati > If you want to set PowerShell as the default shell for OpenSSH, see > [Configuring Windows for OpenSSH][07]. -1. Edit the `sshd_config` file located at `$env:ProgramData\ssh`. +1. Edit the `sshd_config` file located at `$Env:ProgramData\ssh`. Make sure password authentication is enabled: @@ -79,15 +79,15 @@ remote computer. And, you must enable **password** or **key-based** authenticati Create the SSH subsystem that hosts a PowerShell process on the remote computer: ``` - Subsystem powershell c:/progra~1/powershell/7/pwsh.exe -sshs -nologo + Subsystem powershell C:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo ``` > [!NOTE] - > Starting in PowerShell 7.4, you no longer need to use the `-nologo` parameter when running + > Starting in PowerShell 7.4, you no longer need to use the `-NoLogo` parameter when running > PowerShell in SSH server mode. > [!NOTE] - > The default location of the PowerShell executable is `c:/progra~1/powershell/7/pwsh.exe`. The + > The default location of the PowerShell executable is `C:/progra~1/powershell/7/pwsh.exe`. The > location can vary depending on how you installed PowerShell. > > You must use the 8.3 short name for any file paths that contain spaces. There's a bug in @@ -105,7 +105,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati > ```Output > EightDotThreeFileName > --------------------- - > c:\progra~1 + > C:\progra~1 > ``` Optionally, enable key authentication: @@ -122,7 +122,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati Restart-Service sshd ``` -1. Add the path where OpenSSH is installed to your Path environment variable. For example, +1. Add the path where OpenSSH is installed to your PATH environment variable. For example, `C:\Program Files\OpenSSH\`. This entry allows for the `ssh.exe` to be found. ## Install the SSH service on an Ubuntu Linux computer @@ -155,7 +155,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati Add a PowerShell subsystem entry: ``` - Subsystem powershell /usr/bin/pwsh -sshs -nologo + Subsystem powershell /usr/bin/pwsh -sshs -NoLogo ``` > [!NOTE] @@ -163,7 +163,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati > depending on how you installed PowerShell. > [!NOTE] - > Starting in PowerShell 7.4, you no longer need to use the `-nologo` parameter when running + > Starting in PowerShell 7.4, you no longer need to use the `-NoLogo` parameter when running > PowerShell in SSH server mode. 1. Restart the **ssh** service. @@ -202,7 +202,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati Add a PowerShell subsystem entry: ``` - Subsystem powershell /usr/local/bin/pwsh -sshs -nologo + Subsystem powershell /usr/local/bin/pwsh -sshs -NoLogo ``` > [!NOTE] @@ -210,7 +210,7 @@ remote computer. And, you must enable **password** or **key-based** authenticati > vary depending on how you installed PowerShell. > [!NOTE] - > Starting in PowerShell 7.4, you no longer need to use the `-nologo` parameter when running + > Starting in PowerShell 7.4, you no longer need to use the `-NoLogo` parameter when running > PowerShell in SSH server mode. Optionally, enable key authentication: diff --git a/reference/docs-conceptual/security/remoting/jea/role-capabilities.md b/reference/docs-conceptual/security/remoting/jea/role-capabilities.md index bc63d1e1492f..7fb660afe932 100644 --- a/reference/docs-conceptual/security/remoting/jea/role-capabilities.md +++ b/reference/docs-conceptual/security/remoting/jea/role-capabilities.md @@ -1,6 +1,6 @@ --- description: >- - A role capability is a PowerShell data file with the .psrc extension that lists all the cmdlets, + A role capability is a PowerShell data file with the `.psrc` extension that lists all the cmdlets, functions, providers, and external programs that are made available to connecting users. ms.date: 02/02/2023 title: JEA Role Capabilities @@ -300,21 +300,21 @@ module. You make those functions visible in the JEA session using the **VisibleF like you would with built-in and third-party modules. For tab completion to work properly in JEA sessions you must include the built-in function -`tabexpansion2` in the **VisibleFunctions** list. +`TabExpansion2` in the **VisibleFunctions** list. ## Make the role capabilities available to a configuration Prior to PowerShell 6, for PowerShell to find a role capability file it must be stored in a `RoleCapabilities` folder in a PowerShell module. The module can be stored in any folder included -in the `$env:PSModulePath` environment variable, however you shouldn't place it in -`$env:SystemRoot\System32` or a folder where untrusted users could modify the files. +in the `$Env:PSModulePath` environment variable, however you shouldn't place it in +`$Env:SystemRoot\System32` or a folder where untrusted users could modify the files. The following example creates a PowerShell script module called **ContosoJEA** in the -`$env:ProgramFiles` path to host the role capabilities file. +`$Env:ProgramFiles` path to host the role capabilities file. ```powershell # Create a folder for the module -$modulePath = Join-Path $env:ProgramFiles "WindowsPowerShell\Modules\ContosoJEA" +$modulePath = Join-Path $Env:ProgramFiles "WindowsPowerShell\Modules\ContosoJEA" New-Item -ItemType Directory -Path $modulePath # Create an empty script module and module manifest. diff --git a/reference/docs-conceptual/security/remoting/jea/session-configurations.md b/reference/docs-conceptual/security/remoting/jea/session-configurations.md index 8623ed3c9072..a707c5257970 100644 --- a/reference/docs-conceptual/security/remoting/jea/session-configurations.md +++ b/reference/docs-conceptual/security/remoting/jea/session-configurations.md @@ -48,7 +48,7 @@ to the following default commands (and aliases): No PowerShell providers are available, nor are any external programs (executables or scripts). -For more information about language modes, see [about_Language_modes][01]. +For more information about language modes, see [about_Language_Modes][01]. ### Choose the JEA identity @@ -191,7 +191,7 @@ to the user. When specifying local users or groups in the role definitions field, be sure to use the computer name, not **localhost** or wildcards. You can check the computer name by inspecting the -`$env:COMPUTERNAME` variable. +`$Env:COMPUTERNAME` variable. ```powershell RoleDefinitions = @{ @@ -207,7 +207,7 @@ capabilities are available on the system with the same name, PowerShell uses its order to select the effective role capability file. JEA does **not** give access to all role capability files with the same name. -JEA uses the `$env:PSModulePath` environment variable to determine which paths to scan for role +JEA uses the `$Env:PSModulePath` environment variable to determine which paths to scan for role capability files. Within each of those paths, JEA looks for valid PowerShell modules that contain a "RoleCapabilities" subfolder. As with importing modules, JEA prefers role capabilities that are shipped with Windows to custom role capabilities with the same name. diff --git a/reference/docs-conceptual/security/remoting/powershell-remoting-faq.yml b/reference/docs-conceptual/security/remoting/powershell-remoting-faq.yml index 21ed150f8181..7bed894f795c 100644 --- a/reference/docs-conceptual/security/remoting/powershell-remoting-faq.yml +++ b/reference/docs-conceptual/security/remoting/powershell-remoting-faq.yml @@ -88,7 +88,7 @@ sections: These cmdlets include the following: - - `Get-Hotfix` + - `Get-HotFix` - `Rename-Computer` - `Restart-Computer` - `Stop-Computer` @@ -112,7 +112,7 @@ sections: For example: ```PowerShell - Get-Help Get-Hotfix -Parameter ComputerName + Get-Help Get-HotFix -Parameter ComputerName ``` For all other commands, use the `Invoke-Command` cmdlet. @@ -326,7 +326,7 @@ sections: [about_Remote_Jobs](/powershell/module/microsoft.powershell.core/about/about_remote_jobs). - question: | - Can I run windows programs on a remote computer? + Can I run Windows programs on a remote computer? answer: | You can use PowerShell remote commands to run Windows-based programs on remote computers. For example, you can run `Shutdown.exe` or `Ipconfig.exe` on a remote computer. diff --git a/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md b/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md index 8ba5ef9ccc28..13fdd18d5c67 100644 --- a/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md +++ b/reference/docs-conceptual/whats-new/Migrating-from-Windows-PowerShell-51-to-PowerShell-7.md @@ -76,9 +76,9 @@ PowerShell 7 installs to a new directory, enabling side-by-side execution with W Install locations by version: -- Windows PowerShell 5.1: `$env:WINDIR\System32\WindowsPowerShell\v1.0` -- PowerShell 6.x: `$env:ProgramFiles\PowerShell\6` -- PowerShell 7: `$env:ProgramFiles\PowerShell\7` +- Windows PowerShell 5.1: `$Env:windir\System32\WindowsPowerShell\v1.0` +- PowerShell 6.x: `$Env:ProgramFiles\PowerShell\6` +- PowerShell 7: `$Env:ProgramFiles\PowerShell\7` The new location is added to your PATH allowing you to run both Windows PowerShell 5.1 and PowerShell 7. If you're migrating from PowerShell 6.x to PowerShell 7, PowerShell 6 is removed and @@ -97,8 +97,8 @@ load both Core and Desktop modules. | Install Scope | Windows PowerShell 5.1 | PowerShell 7.0 | | ----------------------------------- | ----------------------------------------------------- | ---------------------------------------- | -| PowerShell modules | `$env:WINDIR\system32\WindowsPowerShell\v1.0\Modules` | `$env:ProgramFiles\PowerShell\7\Modules` | -| User installed
AllUsers scope | `$env:ProgramFiles\WindowsPowerShell\Modules` | `$env:ProgramFiles\PowerShell\Modules` | +| PowerShell modules | `$Env:windir\system32\WindowsPowerShell\v1.0\Modules` | `$Env:ProgramFiles\PowerShell\7\Modules` | +| User installed
AllUsers scope | `$Env:ProgramFiles\WindowsPowerShell\Modules` | `$Env:ProgramFiles\PowerShell\Modules` | | User installed
CurrentUser scope | `$HOME\Documents\WindowsPowerShell\Modules` | `$HOME\Documents\PowerShell\Modules` | The following examples show the default values of `$Env:PSModulePath` for each version. diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md index e927e6259f25..707071e803d8 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-73.md @@ -32,7 +32,7 @@ PowerShell 7.3 includes the following features, updates, and breaking changes. ## Tab completion improvements -- PowerShell 7.3 includes PSReadline 2.2.6, which enables Predictive IntelliSense by default. For +- PowerShell 7.3 includes PSReadLine 2.2.6, which enables Predictive IntelliSense by default. For more information, see [about_PSReadLine][12]. - Fix tab completion within the script block specified for the `ValidateScriptAttribute`. ([#14550][14550]) (Thanks @MartinGC94!) @@ -85,7 +85,7 @@ PowerShell 7.3 includes the following features, updates, and breaking changes. - Add `-HttpVersion` parameter to web cmdlets ([#15853][15853]) (Thanks @hayhay27!) - Add support to web cmdlets for open-ended input tags ([#16193][16193]) (Thanks @farmerau!) - Fix `ConvertTo-Json -Depth` to allow 100 at maximum ([#16197][16197]) (Thanks @KevRitchie!) -- Improve variable handling when calling `Invoke-Command` with the `$using:` expression +- Improve variable handling when calling `Invoke-Command` with the `$Using:` expression ([#16113][16113]) (Thanks @dwtaber!) - Add `-StrictMode` to `Invoke-Command` to allow specifying strict mode when invoking command locally ([#16545][16545]) (Thanks @Thomas-Yu!) @@ -104,7 +104,7 @@ PowerShell 7.3 includes the following features, updates, and breaking changes. - Render decimal numbers in a table using current culture ([#17650][17650]) - Add type accelerator ordered for **OrderedDictionary** ([#17804][17804]) (Thanks @fflaten!) - Add `find.exe` to legacy argument binding behavior for Windows ([#17715][17715]) -- Add `-noprofileloadtime` switch to pwsh ([#17535][17535]) (Thanks @rkeithhill!) +- Add `-NoProfileLoadTime` switch to pwsh ([#17535][17535]) (Thanks @rkeithhill!) For a complete list of changes, see the [Change Log][11] in the GitHub repository. diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md index b1f62dfeeafe..241d15bbb71c 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-74.md @@ -17,7 +17,7 @@ For a complete list of changes, see the [CHANGELOG][chg] in the GitHub repositor - Added the **ProgressAction** parameter to the Common Parameters - Update some PowerShell APIs to throw **ArgumentException** instead of **ArgumentNullException** when the argument is an empty string ([#19215][19215]) (Thanks @xtqqczze!) -- Remove code related to `#requires -pssnapin` ([#19320][19320]) +- Remove code related to `#Requires -PSSnapin` ([#19320][19320]) - `Test-Json` now uses JsonSchema.NET instead of Newtonsoft.Json.Schema. - With this change, `Test-Json` no longer supports the older Draft 4 schemas. ([#18141][18141]) (Thanks @gregsdennis!). For more information about JSON schemas, see [JSON Schema][14] @@ -68,7 +68,7 @@ Many thanks to **@MartinGC94** and others for all their work to improve tab comp - Fix member completion in attribute argument ([#17902][17902]) - Exclude redundant parameter aliases from completion results ([#19382][19382]) - Fix class member completion for classes with base types ([#19179][19179]) -- Add completion for Using keywords ([#16514][18758]) +- Add completion for the `using` keyword ([#16514][18758]) - Fix TabExpansion2 variable leak when completing variables ([#18763][18763]) - Enable completion of variables across ScriptBlock scopes ([#19819][19819]) - Fix completion of the foreach statement variable ([#19814][19814]) @@ -84,7 +84,7 @@ Many thanks to **@MartinGC94** and others for all their work to improve tab comp - Update parameter completion for enums to exclude values not allowed by `ValidateRange` attributes ([#17750][17750]) (Thanks @fflaten!). - Fix dynamic parameter completion ([#19510][19510]) -- Add completion for variables assigned by the Data statement ([#19831][19831]) +- Add completion for variables assigned by the `data` statement ([#19831][19831]) - Fix expanding tilde (`~`) on Windows systems to `$HOME` to prevent breaking use cases with native commands ([#21529][21529]) @@ -188,7 +188,7 @@ Other Engine updates - Add a public API for getting locations of PSModulePath elements ([#19422][19422]) - Fix incorrect string to type conversion ([#19560][19560]) (Thanks @MartinGC94!) - Fix slow execution when many breakpoints are used ([#14953][14953]) (Thanks @nohwnd!) -- Remove code related to `#requires -pssnapin` ([#19320][19320]) +- Remove code related to `#Requires -PSSnapin` ([#19320][19320]) ## Experimental Features diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md index 2959bd1bc3b5..42adbb8aa523 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-75.md @@ -150,7 +150,7 @@ PowerShell 7.5-rc.1: The following experimental features are included in PowerShell 7.5-rc.1: - [PSRedirectToVariable][05] - Allow redirecting to a variable ([#20381][20381]) -- [PSNativeWindowsTildeExpansion][01] - Add tilde expansion for windows native executables +- [PSNativeWindowsTildeExpansion][01] - Add tilde expansion for Windows-native executables ([#20402][20402]) (Thanks @domsleee!) - [PSSerializeJSONLongEnumAsNumber][06] - `ConvertTo-Json` now treats large enums as numbers ([#20999][20999]) (Thanks @jborean93!) @@ -196,7 +196,7 @@ $tests = @{ [pscustomobject]@{ CollectionSize = $_ Test = $test.Key - TotalMilliseconds = [math]::Round($ms, 2) + TotalMilliseconds = [Math]::Round($ms, 2) } [GC]::Collect() @@ -208,7 +208,7 @@ $tests = @{ Name = 'RelativeSpeed' Expression = { $relativeSpeed = $_.TotalMilliseconds / $groupResult[0].TotalMilliseconds - $speed = [math]::Round($relativeSpeed, 2).ToString() + 'x' + $speed = [Math]::Round($relativeSpeed, 2).ToString() + 'x' if ($speed -eq '1x') { $speed } else { $speed + ' slower' } } } | Format-Table -AutoSize diff --git a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-76.md b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-76.md index d5b0bc40abfd..ddc84c6d9a19 100644 --- a/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-76.md +++ b/reference/docs-conceptual/whats-new/What-s-New-in-PowerShell-76.md @@ -73,7 +73,7 @@ PowerShell 7.6-preview.3 includes the following updated modules: The following experimental features are included in PowerShell 7.6-preview.3: -- [PSNativeWindowsTildeExpansion][01] - Add tilde expansion for windows native executables +- [PSNativeWindowsTildeExpansion][01] - Add tilde expansion for Windows-native executables - [PSRedirectToVariable][02] - Allow redirecting to a variable - [PSSerializeJSONLongEnumAsNumber][03] - `ConvertTo-Json` now treats large enums as numbers diff --git a/reference/docs-conceptual/whats-new/cmdlet-versions.md b/reference/docs-conceptual/whats-new/cmdlet-versions.md index df9236924ed0..3d21f4250dae 100644 --- a/reference/docs-conceptual/whats-new/cmdlet-versions.md +++ b/reference/docs-conceptual/whats-new/cmdlet-versions.md @@ -37,8 +37,8 @@ This is a work in progress. Please help us keep this information fresh. | [Microsoft.PowerShell.Utility][17] | ![Included][01] | ![Included][01] | ![Included][01] | ![Included][01] | | | [Microsoft.WsMan.Management][18] | ![Included][01] | ![Included][01] | ![Included][01] | ![Included][01] | Windows only | | [PackageManagement][19] | ![Included][01] | ![Included][01] | ![Included][01] | ![Included][01] | | -| [PowershellGet 1.1][20] | ![Included][01] | | | | Must upgrade to v2.x | -| [PowershellGet 2.x][20] | | ![Included][01] | ![Included][01] | ![Included][01] | New versions available from the Gallery | +| [PowerShellGet 1.1][20] | ![Included][01] | | | | Must upgrade to v2.x | +| [PowerShellGet 2.x][20] | | ![Included][01] | ![Included][01] | ![Included][01] | New versions available from the Gallery | | [PSDesiredStateConfiguration 1.1][21] | ![Included][01] | | | | Removed in 7.2 - available from the Gallery | | [PSDesiredStateConfiguration 2.x][22] | | | | | Removed in 7.2 - available from the Gallery | | [PSDesiredStateConfiguration 3.x][23] | | | | | Preview available from the Gallery | @@ -517,7 +517,7 @@ This modules is only available in Windows PowerShell. | Uninstall-Package | ![Included][01] | ![Included][01] | ![Included][01] | ![Included][01] | | | Unregister-PackageSource | ![Included][01] | ![Included][01] | ![Included][01] | ![Included][01] | | -### PowershellGet 2.x +### PowerShellGet 2.x | Cmdlet name | 5.1 | 7.4 | 7.5 | 7.6 | Note | | ------------------------------- | --------------- | --------------- | --------------- | --------------- | ---- | diff --git a/reference/docs-conceptual/whats-new/differences-from-windows-powershell.md b/reference/docs-conceptual/whats-new/differences-from-windows-powershell.md index 0494e99b5a2a..77b318eb4d34 100644 --- a/reference/docs-conceptual/whats-new/differences-from-windows-powershell.md +++ b/reference/docs-conceptual/whats-new/differences-from-windows-powershell.md @@ -301,7 +301,7 @@ Additional changes to `pwsh(.exe)` from `powershell.exe`: - `pwsh` accepts the `-i` (or `-Interactive`) switch to indicate an interactive shell. This allows PowerShell to be used as a default shell on Unix platforms. - Removed parameters `-ImportSystemModules` and `-PSConsoleFile` from `pwsh.exe`. -- Changed `pwsh -version` and built-in help for `pwsh.exe` to align with other native tools. +- Changed `pwsh -Version` and built-in help for `pwsh.exe` to align with other native tools. - Invalid argument error messages for `-File` and `-Command` and exit codes consistent with Unix standards - Added `-WindowStyle` parameter on Windows. Similarly, package-based installations updates on @@ -346,7 +346,7 @@ The PowerShell 7.2 MSI package includes following command-line options: On Unix, it is a convention for shells to accept `-i` for an interactive shell and many tools expect this behavior (`script` for example, and when setting PowerShell as the default shell) and calls the shell with the `-i` switch. This change is breaking in that `-i` previously could be used -as short hand to match `-inputformat`, which now needs to be `-in`. +as short hand to match `-InputFormat`, which now needs to be `-in`. ### Custom snap-ins @@ -401,7 +401,7 @@ tools and operating systems. ### Unify cmdlets with parameter `-Encoding` to be of type `System.Text.Encoding` -The `-Encoding` value `Byte` has been removed from the filesystem provider cmdlets. A new parameter, +The `-Encoding` value `Byte` has been removed from the FileSystem provider cmdlets. A new parameter, `-AsByteStream`, is now used to specify that a byte stream is required as input or that the output is a stream of bytes. @@ -636,7 +636,7 @@ You can convert a `PSMethod` into a delegate. This allows you to do things like class M { static [int] DoubleStrLen([string] $value) { return 2 * $value.Length } - static [long] AggregateString([string[]] $values, [func[string, int]] $selector) { + static [long] AggregateString([string[]] $values, [Func[string, int]] $selector) { [long] $res = 0 foreach($s in $values){ $res += $selector.Invoke($s) @@ -729,7 +729,7 @@ With **ConciseView**, if an error is not from a script or parser error, then it' error message: ```powershell -Get-Childitem -Path c:\NotReal +Get-ChildItem -Path C:\NotReal ``` ```Output @@ -803,8 +803,8 @@ name. The new **ThrottleLimit** parameter limits the number of script blocks running in parallel at a given time. The default is 5. -Use the `$_` variable to represent the current input object in the script block. Use the `$using:` -scope to pass variable references to the running script block. +Use the `$_` variable to represent the current input object in the script block. Use the `Using:` +scope modifier to pass variable references to the running script block. For more information, see [ForEach-Object][12]. @@ -899,15 +899,15 @@ Previously, the `Import-Csv` cmdlet cannot be used to directly import the log fi log format and additional action would be required. With this change, W3C extended log format is supported. -### `Import-Csv` applies `PSTypeNames` upon import when type information is present in the CSV +### `Import-Csv` applies `pstypenames` upon import when type information is present in the CSV -Previously, objects exported using `Export-CSV` with `TypeInformation` imported with +Previously, objects exported using `Export-Csv` with `TypeInformation` imported with `ConvertFrom-Csv` were not retaining the type information. This change adds the type information to -`PSTypeNames` member if available from the CSV file. +`pstypenames` member if available from the CSV file. ### `-NoTypeInformation` is the default on `Export-Csv` -Previously, the `Export-CSV` cmdlet would output a comment as the first line containing the type +Previously, the `Export-Csv` cmdlet would output a comment as the first line containing the type name of the object. The change excludes the type information by default because it's not understood by most CSV tools. This change was made to address customer feedback. @@ -963,7 +963,7 @@ In the past, PowerShell shipped a function on Windows called `more` that wrapped function has now been removed. Also, the `help` function changed to use `more.com` on Windows, or the system's default pager -specified by `$env:PAGER` on non-Windows platforms. +specified by `$Env:PAGER` on non-Windows platforms. ### `cd DriveName:` now returns users to the current working directory in that drive diff --git a/reference/docs-conceptual/whats-new/unix-support.md b/reference/docs-conceptual/whats-new/unix-support.md index 81b49ec73e09..339a5cf16c15 100644 --- a/reference/docs-conceptual/whats-new/unix-support.md +++ b/reference/docs-conceptual/whats-new/unix-support.md @@ -36,7 +36,7 @@ returns **Unrestricted** on Linux and macOS. `Set-ExecutionPolicy` does nothing ## Case-sensitivity in PowerShell -Historically, PowerShell has been uniformly case-insensitive, with few exceptions. On UNIX-like +Historically, PowerShell has been uniformly case-insensitive, with few exceptions. On Unix-like operating systems, the file system is predominantly case-sensitive, and PowerShell adheres to the standard of the file system. @@ -54,7 +54,7 @@ standard of the file system. - Paths given to cmdlets are now slash-agnostic (both `/` and `\` work as directory separators) - XDG Base Directory Specification is now respected and used by default: - The Linux/macOS profile path is located at `~/.config/powershell/profile.ps1` - - The history save path is located at `~/.local/share/powershell/PSReadline/ConsoleHost_history.txt` + - The history save path is located at `~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt` - The user module path is located at `~/.local/share/powershell/Modules` - Support for file and folder names containing the colon character on Unix. - Support for script names or full paths that have commas. diff --git a/reference/docs-conceptual/windows-powershell/Starting-Windows-PowerShell.md b/reference/docs-conceptual/windows-powershell/Starting-Windows-PowerShell.md index ba00ec56a6b8..24b02b093cf9 100644 --- a/reference/docs-conceptual/windows-powershell/Starting-Windows-PowerShell.md +++ b/reference/docs-conceptual/windows-powershell/Starting-Windows-PowerShell.md @@ -41,7 +41,7 @@ In Windows Command shell, Windows PowerShell, or Windows PowerShell ISE, to star PowerShell, type: `PowerShell`. You can also use the parameters of the `powershell.exe` program to customize the session. For more -information, see [PowerShell.exe Command-Line Help][03]. +information, see [about_PowerShell_exe][03]. ### With Administrative privileges (Run as administrator) diff --git a/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md index ed6307b2872e..c63de147996a 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Accessibility-in-Windows-PowerShell-ISE.md @@ -165,12 +165,12 @@ You can use the following keyboard shortcuts when you use Windows PowerShell tab ## Keyboard shortcuts for starting and exiting You can use the following keyboard shortcuts to start the Windows PowerShell console -(**PowerShell.exe**) or to exit Windows PowerShell ISE. +(`powershell.exe`) or to exit Windows PowerShell ISE. | Action | Keyboard Shortcut | | ----------------------------------------------------- | --------------------------------------------- | | **Exit** | ALT+F4 | -| **Start PowerShell.exe** (Windows PowerShell console) | CTRL+SHIFT+P | +| **Start powershell.exe** (Windows PowerShell console) | CTRL+SHIFT+P | ## Breakpoint Management diff --git a/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md index 341877966f69..f8989f9011be 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Exploring-the-Windows-PowerShell-ISE.md @@ -49,7 +49,7 @@ The following buttons are located on the toolbar. | **Run Selection** | Runs a selected portion of a script. | | **Stop Operation** | Stops a script that's running. | | **New Remote PowerShell Tab** | Creates a new PowerShell Tab that establishes a session on a remote computer. A dialog box appears and prompts you to enter details required to establish the remote connection. | -| **Start PowerShell.exe** | Opens a PowerShell Console. | +| **Start powershell.exe** | Opens a PowerShell Console. | | **Show Script Pane Top** | Moves the Script Pane to the top in the display. | | **Show Script Pane Right** | Moves the Script Pane to the right in the display. | | **Show Script Pane Maximized** | Maximizes the Script Pane. | diff --git a/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md b/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md index 2f9600e55bd9..265e506fbb68 100644 --- a/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md +++ b/reference/docs-conceptual/windows-powershell/ise/Keyboard-Shortcuts-for-the-Windows-PowerShell-ISE.md @@ -123,7 +123,7 @@ Windows PowerShell session outside of the ISE. | Action | Keyboard Shortcut | | ------------------------ | -------------------------------------------------------------------------------------------------------- | | **Exit** | ALT+F4 closes the ISE. | -| **Start PowerShell.exe** | CTRL+SHIFT+P opens a new Windows PowerShell session outside of the ISE. | +| **Start powershell.exe** | CTRL+SHIFT+P opens a new Windows PowerShell session outside of the ISE. | ## See Also diff --git a/reference/docs-conceptual/windows-powershell/ise/object-model/Other-Useful-Scripting-Objects.md b/reference/docs-conceptual/windows-powershell/ise/object-model/Other-Useful-Scripting-Objects.md index aeff551a7342..55c669dce1a8 100644 --- a/reference/docs-conceptual/windows-powershell/ise/object-model/Other-Useful-Scripting-Objects.md +++ b/reference/docs-conceptual/windows-powershell/ise/object-model/Other-Useful-Scripting-Objects.md @@ -53,7 +53,7 @@ Value : WindowsPowerShellHelp.chm::/html/0c836a1b-f389-4e9a-9325-0f415686d194.ht The following script adds an entry to the list. ```powershell -$psLocalHelp.Add("get-myNoun", "c:\MyFolder\MyHelpChm.chm::/html/0198854a-1298-57ae-aa0c-87b5e5a84712.htm") +$psLocalHelp.Add("Get-MyNoun", "C:\MyFolder\MyHelpChm.chm::/html/0198854a-1298-57ae-aa0c-87b5e5a84712.htm") ``` ### $psOnlineHelp @@ -77,7 +77,7 @@ Value : https://go.microsoft.com/fwlink/p/?LinkID=113278 The following script adds an entry to the list. ```powershell -$psOnlineHelp.Add("get-myNoun", "https://www.mydomain.com/MyNoun.html") +$psOnlineHelp.Add("Get-MyNoun", "https://www.mydomain.com/MyNoun.html") ``` ## See Also diff --git a/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEAddOnToolCollection-Object.md b/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEAddOnToolCollection-Object.md index f6a8267aba03..e40da29044a3 100644 --- a/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEAddOnToolCollection-Object.md +++ b/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEAddOnToolCollection-Object.md @@ -29,7 +29,7 @@ If set to `$true`, the add-on tool is immediately visible in the associated tool ```powershell # Load a DLL with an add-on and then add it to the ISE -[reflection.assembly]::LoadFile("c:\test\ISESimpleSolution\ISESimpleSolution.dll") +[Reflection.Assembly]::LoadFile("C:\test\ISESimpleSolution\ISESimpleSolution.dll") $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add("Solutions", [ISESimpleSolution.Solution], $true) ``` @@ -44,7 +44,7 @@ Specifies the object to be removed from Windows PowerShell ISE. ```powershell # Load a DLL with an add-on and then add it to the ISE -[reflection.assembly]::LoadFile("c:\test\ISESimpleSolution\ISESimpleSolution.dll") +[Reflection.Assembly]::LoadFile("C:\test\ISESimpleSolution\ISESimpleSolution.dll") $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add("Solutions", [ISESimpleSolution.Solution], $true) ``` diff --git a/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEFile-Object.md b/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEFile-Object.md index 8965208784c8..b601303d2b4e 100644 --- a/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEFile-Object.md +++ b/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISEFile-Object.md @@ -59,7 +59,7 @@ character encoding parameter to be used for the saved file. The default value is ```powershell # Save the file with a full path and name. -$fullpath = "c:\temp\newname.txt" +$fullpath = "C:\temp\newname.txt" $psISE.CurrentFile.SaveAs($fullPath) # Save the file with a full path and name and explicitly as UTF8. $psISE.CurrentFile.SaveAs($fullPath, [System.Text.Encoding]::UTF8) diff --git a/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISESnippetCollection-Object.md b/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISESnippetCollection-Object.md index 7c79b1128686..b9441da9ab4b 100644 --- a/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISESnippetCollection-Object.md +++ b/reference/docs-conceptual/windows-powershell/ise/object-model/The-ISESnippetCollection-Object.md @@ -16,12 +16,12 @@ that is associated with a **PowerShellTab** object is a member of this class. An Supported in Windows PowerShell ISE 3.0 and later, and not present in earlier versions. -Loads a `.snippets.ps1xml` file that contains user-defined snippets. The easiest way to create +Loads a `snippets.ps1xml` file that contains user-defined snippets. The easiest way to create snippets is to use the `New-IseSnippet` cmdlet, which automatically stores them in your profile folder so that they are loaded every time that you start Windows PowerShell ISE. **FilePathName** - String -The path and file name to a .snippets.ps1xml file that contains snippet definitions. +The path and file name to a `snippets.ps1xml` file that contains snippet definitions. ```powershell # Loads a custom snippet file into the current PowerShell tab. diff --git a/reference/docs-conceptual/windows-powershell/ise/object-model/The-PowerShellTab-Object.md b/reference/docs-conceptual/windows-powershell/ise/object-model/The-PowerShellTab-Object.md index e591674ef072..5a86a62af581 100644 --- a/reference/docs-conceptual/windows-powershell/ise/object-model/The-PowerShellTab-Object.md +++ b/reference/docs-conceptual/windows-powershell/ise/object-model/The-PowerShellTab-Object.md @@ -174,14 +174,14 @@ The read-only property that gets the Output pane of the current [editor](The-ISE ```powershell # Clears the text in the Output pane. -$psISE.CurrentPowerShellTab.output.clear() +$psISE.CurrentPowerShellTab.Output.Clear() ``` ### Prompt Supported in Windows PowerShell ISE 2.0 and later. -The read-only property that gets the current prompt text. Note: the **Prompt** function can be +The read-only property that gets the current prompt text. Note: the **prompt** function can be overridden by the user'™s profile. If the result is other than a simple string, then this property returns nothing.