diff --git a/reference/5.1/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md b/reference/5.1/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md index 7c713e194b41..fec33c9f3f51 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md @@ -98,7 +98,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 300 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 1 Name : Full XmlRenderingType : text @@ -129,7 +129,7 @@ the content of the Plugin node. This is another way to look at the session confi computer. ```powershell -dir wsman:\localhost\plugin +dir WSMan:\localhost\plugin ``` ```Output @@ -206,7 +206,7 @@ Name PSVersion StartupScript Permission ---- --------- ------------- ---------- -------------- microsoft.powershell 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com microsoft.powershell32 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com -MyX86Shell 5.1 c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com +MyX86Shell 5.1 C:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com ``` The `Enable-WSManCredSSP` cmdlet enables **CredSSP** delegation on Server01, the local computer. The @@ -225,7 +225,7 @@ This example is useful for setting the value of the `$PSSessionConfigurationName variable, which takes a resource URI. ``` -(Get-PSSessionConfiguration -Name CustomShell).resourceURI +(Get-PSSessionConfiguration -Name CustomShell).ResourceUri ``` ```Output diff --git a/reference/5.1/Microsoft.PowerShell.Core/Import-Module.md b/reference/5.1/Microsoft.PowerShell.Core/Import-Module.md index 3a1631a73763..936a2951e787 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Import-Module.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Import-Module.md @@ -88,8 +88,8 @@ Import-Module [-Global] [-Prefix ] [-Function ] [-Cmdlet Get-Module -ListAvailable PowerShellGet | Select-Object Path Path ---- C:\Program Files\PowerShell\Modules\PowerShellGet\2.2.1\PowerShellGet.psd1 -C:\program files\powershell\6\Modules\PowerShellGet\PowerShellGet.psd1 +C:\Program Files\PowerShell\6\Modules\PowerShellGet\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.2\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1 @@ -931,7 +931,7 @@ the module, such as a `.psd1`, `.psm1`, `.dll`, or `.ps1` file. File paths are o characters aren't permitted. You can also pipe module names and filenames to `Import-Module`. If you omit a path, `Import-Module` looks for the module in the paths saved in the -`$env:PSModulePath` environment variable. +`$Env:PSModulePath` environment variable. Specify only the module name whenever possible. When you specify a filename, only the members that are implemented in that file are imported. If the module contains other files, they aren't @@ -1187,7 +1187,7 @@ Windows PowerShell includes the following aliases for `Import-Module`: in the `PSModulePath` environmental variable. For more information, see [about_Modules](About/about_Modules.md). - You can also use the **PSSession** and **CIMSession** parameters to import modules that are + You can also use the **PSSession** and **CimSession** parameters to import modules that are installed on remote computers. However, commands that use the cmdlets in these modules run in the remote session on the remote computer. @@ -1228,7 +1228,7 @@ Windows PowerShell includes the following aliases for `Import-Module`: To import a module that contains mixed-mode assemblies, start Windows PowerShell 2.0 by using the following command, and then try the `Import-Module` command again. - `PowerShell.exe -Version 2.0` + `powershell.exe -Version 2.0` - To use the CIM session feature, the remote computer must have WS-Management remoting and Windows Management Instrumentation (WMI), which is the Microsoft implementation of the Common Information diff --git a/reference/5.1/Microsoft.PowerShell.Core/Invoke-Command.md b/reference/5.1/Microsoft.PowerShell.Core/Invoke-Command.md index 2c67fdf73436..ee2df3a82823 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Invoke-Command.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Invoke-Command.md @@ -157,7 +157,7 @@ Some code samples use splatting to reduce the line length. For more information, This example runs the `Test.ps1` script on the Server01 computer. ```powershell -Invoke-Command -FilePath c:\scripts\test.ps1 -ComputerName Server01 +Invoke-Command -FilePath C:\scripts\test.ps1 -ComputerName Server01 ``` The **FilePath** parameter specifies a script that is located on the local computer. The script runs @@ -207,10 +207,10 @@ This example compares the effects of using **ComputerName** and **Session** para data. ```powershell -Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process powershell } Invoke-Command -ComputerName Server02 -ScriptBlock { $p.VirtualMemorySize } $s = New-PSSession -ComputerName Server02 -Invoke-Command -Session $s -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -Session $s -ScriptBlock { $p = Get-Process powershell } Invoke-Command -Session $s -ScriptBlock { $p.VirtualMemorySize } ``` @@ -300,13 +300,13 @@ but the job exists on the local computer. The results are transmitted to the loc ```powershell $s = New-PSSession -ComputerName Server01, Server02 -Invoke-Command -Session $s -ScriptBlock { Get-EventLog system } -AsJob +Invoke-Command -Session $s -ScriptBlock { Get-EventLog System } -AsJob ``` ```Output Id Name State HasMoreData Location Command --- ---- ----- ----- ----------- --------------- -1 Job1 Running True Server01,Server02 Get-EventLog system +1 Job1 Running True Server01,Server02 Get-EventLog System ``` ```powershell @@ -318,7 +318,7 @@ $j | Format-List -Property * HasMoreData : True StatusMessage : Location : Server01,Server02 -Command : Get-EventLog system +Command : Get-EventLog System JobStateInfo : Running Finished : System.Threading.ManualResetEvent InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca @@ -351,9 +351,9 @@ the results in the `$results` variable. ### Example 9: Include local variables in a command run on a remote computer This example shows how to include the values of local variables in a command run on a remote -computer. The command uses the `Using` scope modifier to identify a local variable in a remote -command. By default, all variables are assumed to be defined in the remote session. The `Using` -scope modifier was introduced in PowerShell 3.0. For more information about the `Using` scope +computer. The command uses the `Using:` scope modifier to identify a local variable in a remote +command. By default, all variables are assumed to be defined in the remote session. The `Using:` +scope modifier was introduced in PowerShell 3.0. For more information about the `Using:` scope modifier, see [about_Remote_Variables](./About/about_Remote_Variables.md) and [about_Scopes](./about/about_scopes.md). @@ -366,8 +366,8 @@ Invoke-Command -ComputerName Server01 -ScriptBlock { The `$Log` variable stores the name of the event log, Windows PowerShell. The `Invoke-Command` cmdlet runs `Get-EventLog` on Server01 to get the ten newest events from the event log. The value of -the **LogName** parameter is the `$Log` variable, which is prefixed by the `Using` scope modifier to -indicate that it was created in the local session, not in the remote session. +the **LogName** parameter is the `$Log` variable, which is prefixed by the `Using:` scope modifier +to indicate that it was created in the local session, not in the remote session. ### Example 10: Hide the computer name @@ -377,7 +377,7 @@ display. You can still use the **Format** cmdlets to display the **PsComputerNam of the affected objects. ```powershell -Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process PowerShell } +Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process powershell } ``` ```Output @@ -389,7 +389,7 @@ S2 777 14 35100 30988 150 3.68 67 Po ```powershell Invoke-Command -ComputerName S1, S2 -HideComputerName -ScriptBlock { - Get-Process PowerShell + Get-Process powershell } ``` @@ -405,21 +405,21 @@ process. The output of the first command includes the **PsComputerName** propert the name of the computer on which the command ran. The output of the second command, which uses **HideComputerName**, doesn't include the **PsComputerName** column. -### Example 11: Use the Param keyword in a script block +### Example 11: Use the `param` keyword in a script block -The `Param` keyword and the **ArgumentList** parameter are used to pass variable values to named +The `param` keyword and the **ArgumentList** parameter are used to pass variable values to named parameters in a script block. This example displays filenames that begin with the letter `a` and have the `.pdf` extension. -For more information about the `Param` keyword, see +For more information about the `param` keyword, see [about_Language_Keywords](./about/about_language_keywords.md#param). ```powershell $parameters = @{ ComputerName = 'Server01' ScriptBlock = { - Param ($param1, $param2) - Get-ChildItem -Name $param1 -Include $param2 + param ($Param1, $Param2) + Get-ChildItem -Name $Param1 -Include $Param2 } ArgumentList = 'a*', '*.pdf' } @@ -433,8 +433,8 @@ ac.pdf az.pdf ``` -`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$param1` and -`$param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable +`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$Param1` and +`$Param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable names. The **ArgumentList** passes the values to the variables. ### Example 12: Use the $args automatic variable in a script block @@ -1415,7 +1415,7 @@ on a single computer. If the remote computer isn't in a domain that the local computer trusts, the computer might not be able to authenticate the user's credentials. To add the remote computer to the list of trusted hosts -in WS-Management, use the following command in the `WSMAN` provider, where `` +in WS-Management, use the following command in the `WSMan` provider, where `` is the name of the remote computer: `Set-Item -Path WSMan:\Localhost\Client\TrustedHosts -Value \` diff --git a/reference/5.1/Microsoft.PowerShell.Core/New-Module.md b/reference/5.1/Microsoft.PowerShell.Core/New-Module.md index 6a459b0243f6..201810a9ea51 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/New-Module.md +++ b/reference/5.1/Microsoft.PowerShell.Core/New-Module.md @@ -84,7 +84,7 @@ This example demonstrates that dynamic modules are not returned by the `Get-Modu members that they export are returned by the `Get-Command` cmdlet. ```powershell -new-module -scriptblock {function Hello {"Hello!"}} +New-Module -ScriptBlock {function Hello {"Hello!"}} ``` ```Output @@ -122,7 +122,7 @@ This example uses the `Export-ModuleMember` cmdlet to export a variable into the Without the `Export-ModuleMember` command, only the function is exported. ```powershell -New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($name) { "Hello, $name" }; Export-ModuleMember -function SayHello -Variable SayHelloHelp} +New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($Name) { "Hello, $Name" }; Export-ModuleMember -Function SayHello -Variable SayHelloHelp} $SayHelloHelp ``` @@ -151,7 +151,7 @@ return any objects by default, there is no output from this command. `Get-Module **GreetingModule** has been imported into the current session. ```powershell -New-Module -ScriptBlock {function Hello {"Hello!"}} -name GreetingModule | Import-Module +New-Module -ScriptBlock {function Hello {"Hello!"}} -Name GreetingModule | Import-Module Get-Module ``` @@ -173,7 +173,7 @@ NestedModules : {} ``` ```powershell -Get-Command hello +Get-Command Hello ``` ```Output @@ -196,8 +196,8 @@ The `$m` variable appears to have no assigned value. ```powershell $m = New-Module -ScriptBlock { - function Hello ($name) {"Hello, $name"} - function Goodbye ($name) {"Goodbye, $name"} + function Hello ($Name) {"Hello, $Name"} + function Goodbye ($Name) {"Goodbye, $Name"} } -AsCustomObject $m $m | Get-Member @@ -217,7 +217,7 @@ Hello ScriptMethod System.Object Hello(); ``` ```powershell -$m.goodbye("Jane") +$m.Goodbye("Jane") ``` ```Output @@ -225,7 +225,7 @@ Goodbye, Jane ``` ```powershell -$m.hello("Manoj") +$m.Hello("Manoj") ``` ```Output diff --git a/reference/5.1/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md b/reference/5.1/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md index fbf61ba68166..ec5da1f5bbd5 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md +++ b/reference/5.1/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md @@ -29,8 +29,8 @@ New-PSRoleCapabilityFile [-Path] [-Guid ] [-Author ] [-De The `New-PSRoleCapabilityFile` cmdlet creates a file that defines a set of user capabilities that can be exposed through session configuration files. This includes determining which cmdlets, functions, and scripts are available to users. The capability file is a human-readable text file -that contains a hash table of session configuration properties and values. The file has a .psrc file -name extension, and can be used by more than one session configuration. +that contains a hash table of session configuration properties and values. The file has a `.psrc` +file name extension, and can be used by more than one session configuration. All the parameters of `New-PSRoleCapabilityFile` are optional except for the **Path** parameter, which specifies the path for the file. If you don't include a parameter when you run the cmdlet, the @@ -235,7 +235,7 @@ the following keys: For example: -`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process PowerShell};Options="AllScope"}` +`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process powershell};Options="AllScope"}` ```yaml Type: System.Collections.IDictionary[] diff --git a/reference/5.1/Microsoft.PowerShell.Core/New-PSSession.md b/reference/5.1/Microsoft.PowerShell.Core/New-PSSession.md index af06be7f38ed..d412de5b502f 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/New-PSSession.md +++ b/reference/5.1/Microsoft.PowerShell.Core/New-PSSession.md @@ -148,7 +148,7 @@ the `$s` variable. It uses the credentials of the `Domain1\Admin01` user to comp ### Example 6: Create a session with a global scope in a different domain ```powershell -$global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 +$Global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 ``` This example shows how to create a **PSSession** with a global scope on a computer in a different @@ -181,7 +181,7 @@ text file, or other text-convertible format. ### Example 8: Create a session by using a URI ```powershell -$s = New-PSSession -URI http://Server01:91/NewSession -Credential Domain01\User01 +$s = New-PSSession -Uri http://Server01:91/NewSession -Credential Domain01\User01 ``` This command creates a **PSSession** on the Server01 computer and stores it in the `$s` variable. It @@ -193,7 +193,7 @@ that has permission to create a session on the remote computer. ```powershell $s = New-PSSession -ComputerName (Get-Content Servers.txt) -Credential Domain01\Admin01 -ThrottleLimit 16 -Invoke-Command -Session $s -ScriptBlock {Get-Process PowerShell} -AsJob +Invoke-Command -Session $s -ScriptBlock {Get-Process powershell} -AsJob ``` These commands create a set of **PSSession** objects and then run a background job in each of the @@ -210,7 +210,7 @@ command to `16` concurrent connections. The command saves the **PSSession** obje variable. The second command uses the **AsJob** parameter of the `Invoke-Command` cmdlet to start a background -job that runs a `Get-Process PowerShell` command in each of the **PSSession** objects in `$s`. +job that runs a `Get-Process powershell` command in each of the **PSSession** objects in `$s`. For more information about PowerShell background jobs, see [about_Jobs](About/about_Jobs.md) and [about_Remote_Jobs](About/about_Remote_Jobs.md). diff --git a/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md b/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md index 287ce0291b49..ffaf89651ce0 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md +++ b/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md @@ -473,7 +473,7 @@ Accept wildcard characters: False ### -FormatsToProcess -Specifies the formatting files (.ps1xml) that run in sessions that use the session configuration. +Specifies the formatting files (`.ps1xml`) that run in sessions that use the session configuration. The value of this parameter must be a full or absolute path of the formatting files. ```yaml @@ -516,7 +516,7 @@ the following keys: values for this parameter are: None, ReadOnly, Constant, Private, or AllScope. For example: -`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process PowerShell};Options='AllScope'}` +`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process powershell};Options='AllScope'}` ```yaml Type: System.Collections.IDictionary[] @@ -644,10 +644,10 @@ Accept wildcard characters: False Configures sessions that use this session configuration to expose the `User:` PSDrive. User drives are unique for each connecting user and allow users to copy data to and from PowerShell endpoints -even if the File System provider is not exposed. User drive roots are created under -`$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\DriveRoots\`. For each user connecting to the -endpoint, a folder is created with the name `${env:USERDOMAIN}_${env:USERNAME}`. For computers in -workgroups, the value of `$env:USERDOMAIN` is the hostname. +even if the FileSystem provider is not exposed. User drive roots are created under +`$Env:LOCALAPPDATA\Microsoft\Windows\PowerShell\DriveRoots\`. For each user connecting to the +endpoint, a folder is created with the name `${Env:USERDOMAIN}_${Env:USERNAME}`. For computers in +workgroups, the value of `$Env:USERDOMAIN` is the hostname. Contents in the user drive persist across user sessions and are not automatically removed. By default, users can only store up to 50MB of data in the user drive. This can be customized with the @@ -1076,7 +1076,7 @@ value of the **VisibleProviders** parameter is the Certificate provider, but the parameter does not specify the **Microsoft.PowerShell.Security** module that contains the Certificate provider, the Certificate provider is not visible in the session. -`New-PSSessionConfigurationFile` creates a session configuration file that has a .pssc file name +`New-PSSessionConfigurationFile` creates a session configuration file that has a `.pssc` file name extension in the path that you specify in the **Path** parameter. When you use the session configuration file to create a session configuration, the `Register-PSSessionConfiguration` cmdlet copies the configuration file and saves an active copy of the file in the **SessionConfig** diff --git a/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionOption.md b/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionOption.md index 7820f2840c83..e1fe0f07f77f 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionOption.md +++ b/reference/5.1/Microsoft.PowerShell.Core/New-PSSessionOption.md @@ -88,7 +88,7 @@ IdleTimeout : 00:04:00 This example shows how to use a **SessionOption** object to configure a session. ```powershell -$pso = New-PSSessionOption -Culture "fr-fr" -MaximumReceivedObjectSize 10MB +$pso = New-PSSessionOption -Culture "fr-FR" -MaximumReceivedObjectSize 10MB New-PSSession -ComputerName Server01 -SessionOption $pso ``` @@ -138,7 +138,7 @@ TotalMilliseconds : 180000 ```powershell $a.UICulture = (Get-UICulture) -$a.OpenTimeout = (New-Timespan -Minutes 4) +$a.OpenTimeout = (New-TimeSpan -Minutes 4) $a.MaximumConnectionRedirectionCount = 1 $a ``` @@ -339,7 +339,7 @@ The idle time-out value is of significant importance if you intend to disconnect session. You can reconnect only if the session has not timed out. Enter a value in milliseconds. The minimum value is `60000` (1 minute). The maximum is the value of -the **MaxIdleTimeoutms** property of the session configuration. The default value, `-1`, does not +the **MaxIdleTimeoutMs** property of the session configuration. The default value, `-1`, does not set an idle time-out. The session uses the idle time-out that is set in the session options, if any. If none is set diff --git a/reference/5.1/Microsoft.PowerShell.Core/New-PSTransportOption.md b/reference/5.1/Microsoft.PowerShell.Core/New-PSTransportOption.md index 54b640df386c..97d09b404127 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/New-PSTransportOption.md +++ b/reference/5.1/Microsoft.PowerShell.Core/New-PSTransportOption.md @@ -101,7 +101,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 40 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 2 Name : ITTasks XmlRenderingType : text @@ -245,7 +245,7 @@ Accept wildcard characters: False ### -MaxIdleTimeoutSec -Limits the idle time-out set for each session to the specified value. The default value is `[Int]::MaxValue` +Limits the idle time-out set for each session to the specified value. The default value is `[int]::MaxValue` (~25 days). The idle time-out value is of significant importance when the user intends to disconnect and diff --git a/reference/5.1/Microsoft.PowerShell.Core/Receive-Job.md b/reference/5.1/Microsoft.PowerShell.Core/Receive-Job.md index 1809e7969fcd..59d59657ea11 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Receive-Job.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Receive-Job.md @@ -197,7 +197,7 @@ $s = New-PSSession -ComputerName Server01, Server02, Server03 $invokeCommandSplat = @{ Session = $s ScriptBlock = { - Start-Job -Name $('MyJob-' +$env:COMPUTERNAME) -ScriptBlock { + Start-Job -Name $('MyJob-' +$Env:COMPUTERNAME) -ScriptBlock { (Get-Date).ToString() } } @@ -224,7 +224,7 @@ Id Name State HasMoreData Location Command # variable and save the results in the $results variable. The Receive-Job command must be # run in each session because the jobs were run locally on each server. $results = Invoke-Command -Session $s -ScriptBlock { - Receive-Job -Name $('MyJob-' +$env:COMPUTERNAME) + Receive-Job -Name $('MyJob-' +$Env:COMPUTERNAME) } ``` diff --git a/reference/7.4/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md b/reference/7.4/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md index b9b88d7d16dc..a15f664a2a07 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md @@ -98,7 +98,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 300 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 1 Name : Full XmlRenderingType : text @@ -129,7 +129,7 @@ the content of the Plugin node. This is another way to look at the session confi computer. ```powershell -dir wsman:\localhost\plugin +dir WSMan:\localhost\plugin ``` ```Output @@ -206,7 +206,7 @@ Name PSVersion StartupScript Permission ---- --------- ------------- ---------- -------------- microsoft.powershell 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com microsoft.powershell32 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com -MyX86Shell 5.1 c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com +MyX86Shell 5.1 C:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com ``` The `Enable-WSManCredSSP` cmdlet enables **CredSSP** delegation on Server01, the local computer. The @@ -225,7 +225,7 @@ This example is useful for setting the value of the `$PSSessionConfigurationName variable, which takes a resource URI. ```powershell -(Get-PSSessionConfiguration -Name CustomShell).resourceURI +(Get-PSSessionConfiguration -Name CustomShell).ResourceUri ``` ```Output diff --git a/reference/7.4/Microsoft.PowerShell.Core/Import-Module.md b/reference/7.4/Microsoft.PowerShell.Core/Import-Module.md index 570e08a17213..65d7d58fd078 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Import-Module.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Import-Module.md @@ -107,8 +107,8 @@ Import-Module [-Global] [-Prefix ] [-Function ] [-Cmdlet Get-Module -ListAvailable PowerShellGet | Select-Object Path Path ---- C:\Program Files\PowerShell\Modules\PowerShellGet\2.2.1\PowerShellGet.psd1 -C:\program files\powershell\6\Modules\PowerShellGet\PowerShellGet.psd1 +C:\Program Files\PowerShell\6\Modules\PowerShellGet\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.2\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1 @@ -950,7 +950,7 @@ the module, such as a `.psd1`, `.psm1`, `.dll`, or `.ps1` file. File paths are o characters aren't permitted. You can also pipe module names and filenames to `Import-Module`. If you omit a path, `Import-Module` looks for the module in the paths saved in the -`$env:PSModulePath` environment variable. +`$Env:PSModulePath` environment variable. Specify only the module name whenever possible. When you specify a filename, only the members that are implemented in that file are imported. If the module contains other files, they aren't @@ -1143,7 +1143,7 @@ Accept wildcard characters: False Skips the check on the `CompatiblePSEditions` field. -Allows loading a module from the `"$($env:windir)\System32\WindowsPowerShell\v1.0\Modules"` module +Allows loading a module from the `"$($Env:windir)\System32\WindowsPowerShell\v1.0\Modules"` module directory into PowerShell Core when that module doesn't specify `Core` in the `CompatiblePSEditions` manifest field. @@ -1255,7 +1255,7 @@ PowerShell includes the following aliases for `Import-Module`: in the `PSModulePath` environmental variable. For more information, see [about_Modules](About/about_Modules.md). - You can also use the **PSSession** and **CIMSession** parameters to import modules that are + You can also use the **PSSession** and **CimSession** parameters to import modules that are installed on remote computers. However, commands that use the cmdlets in these modules run in the remote session on the remote computer. @@ -1296,7 +1296,7 @@ PowerShell includes the following aliases for `Import-Module`: To import a module that contains mixed-mode assemblies, start Windows PowerShell 2.0 by using the following command, and then try the `Import-Module` command again. - `PowerShell.exe -Version 2.0` + `powershell.exe -Version 2.0` - To use the CIM session feature, the remote computer must have WS-Management remoting and Windows Management Instrumentation (WMI), which is the Microsoft implementation of the Common Information diff --git a/reference/7.4/Microsoft.PowerShell.Core/Invoke-Command.md b/reference/7.4/Microsoft.PowerShell.Core/Invoke-Command.md index 1516ff7f070d..487367e6e7cf 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Invoke-Command.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Invoke-Command.md @@ -200,7 +200,7 @@ Some code samples use splatting to reduce the line length. For more information, This example runs the `Test.ps1` script on the Server01 computer. ```powershell -Invoke-Command -FilePath c:\scripts\test.ps1 -ComputerName Server01 +Invoke-Command -FilePath C:\scripts\test.ps1 -ComputerName Server01 ``` The **FilePath** parameter specifies a script that is located on the local computer. The script runs @@ -250,10 +250,10 @@ This example compares the effects of using **ComputerName** and **Session** para data. ```powershell -Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process powershell } Invoke-Command -ComputerName Server02 -ScriptBlock { $p.VirtualMemorySize } $s = New-PSSession -ComputerName Server02 -Invoke-Command -Session $s -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -Session $s -ScriptBlock { $p = Get-Process powershell } Invoke-Command -Session $s -ScriptBlock { $p.VirtualMemorySize } ``` @@ -343,13 +343,13 @@ but the job exists on the local computer. The results are transmitted to the loc ```powershell $s = New-PSSession -ComputerName Server01, Server02 -Invoke-Command -Session $s -ScriptBlock { Get-EventLog system } -AsJob +Invoke-Command -Session $s -ScriptBlock { Get-EventLog System } -AsJob ``` ```Output Id Name State HasMoreData Location Command --- ---- ----- ----- ----------- --------------- -1 Job1 Running True Server01,Server02 Get-EventLog system +1 Job1 Running True Server01,Server02 Get-EventLog System ``` ```powershell @@ -361,7 +361,7 @@ $j | Format-List -Property * HasMoreData : True StatusMessage : Location : Server01,Server02 -Command : Get-EventLog system +Command : Get-EventLog System JobStateInfo : Running Finished : System.Threading.ManualResetEvent InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca @@ -394,9 +394,9 @@ the results in the `$results` variable. ### Example 9: Include local variables in a command run on a remote computer This example shows how to include the values of local variables in a command run on a remote -computer. The command uses the `Using` scope modifier to identify a local variable in a remote -command. By default, all variables are assumed to be defined in the remote session. The `Using` -scope modifier was introduced in PowerShell 3.0. For more information about the `Using` scope +computer. The command uses the `Using:` scope modifier to identify a local variable in a remote +command. By default, all variables are assumed to be defined in the remote session. The `Using:` +scope modifier was introduced in PowerShell 3.0. For more information about the `Using:` scope modifier, see [about_Remote_Variables](./About/about_Remote_Variables.md) and [about_Scopes](./about/about_scopes.md). @@ -409,7 +409,7 @@ Invoke-Command -ComputerName Server01 -ScriptBlock { The `$Log` variable stores the name of the event log, PowerShellCore/Operational. The `Invoke-Command` cmdlet runs `Get-WinEvent` on Server01 to get the ten newest events from the event -log. The value of the **LogName** parameter is the `$Log` variable that is prefixed by the `Using` +log. The value of the **LogName** parameter is the `$Log` variable that is prefixed by the `Using:` scope modifier to indicate that it was created in the local session, not in the remote session. ### Example 10: Hide the computer name @@ -420,7 +420,7 @@ display. You can still use the **Format** cmdlets to display the **PsComputerNam of the affected objects. ```powershell -Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process PowerShell } +Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process powershell } ``` ```Output @@ -432,7 +432,7 @@ S2 777 14 35100 30988 150 3.68 67 Po ```powershell Invoke-Command -ComputerName S1, S2 -HideComputerName -ScriptBlock { - Get-Process PowerShell + Get-Process powershell } ``` @@ -448,21 +448,21 @@ process. The output of the first command includes the **PsComputerName** propert the name of the computer on which the command ran. The output of the second command, which uses **HideComputerName**, doesn't include the **PsComputerName** column. -### Example 11: Use the Param keyword in a script block +### Example 11: Use the `param` keyword in a script block -The `Param` keyword and the **ArgumentList** parameter are used to pass variable values to named +The `param` keyword and the **ArgumentList** parameter are used to pass variable values to named parameters in a script block. This example displays filenames that begin with the letter `a` and have the `.pdf` extension. -For more information about the `Param` keyword, see +For more information about the `param` keyword, see [about_Language_Keywords](./about/about_language_keywords.md#param). ```powershell $parameters = @{ ComputerName = 'Server01' ScriptBlock = { - Param ($param1, $param2) - Get-ChildItem -Name $param1 -Include $param2 + param ($Param1, $Param2) + Get-ChildItem -Name $Param1 -Include $Param2 } ArgumentList = 'a*', '*.pdf' } @@ -476,8 +476,8 @@ ac.pdf az.pdf ``` -`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$param1` and -`$param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable +`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$Param1` and +`$Param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable names. The **ArgumentList** passes the values to the variables. ### Example 12: Use the $args automatic variable in a script block @@ -732,7 +732,7 @@ $sshConnections = @( KeyFilePath = "/Users/UserB/id_rsa" } ) -$results = Invoke-Command -FilePath c:\Scripts\GetInfo.ps1 -SSHConnection $sshConnections +$results = Invoke-Command -FilePath C:\Scripts\GetInfo.ps1 -SSHConnection $sshConnections ``` ### Example 22: Connect to a remote SSH session using SSH options @@ -747,7 +747,7 @@ $options = @{ User = 'UserB' Host = 'LinuxServer5' } -$results = Invoke-Command -FilePath c:\Scripts\CollectEvents.ps1 -KeyFilePath '/Users/UserB/id_rsa' -Options $options +$results = Invoke-Command -FilePath C:\Scripts\CollectEvents.ps1 -KeyFilePath '/Users/UserB/id_rsa' -Options $options ``` ## PARAMETERS @@ -1730,7 +1730,7 @@ on a single computer. If the remote computer isn't in a domain that the local computer trusts, the computer might not be able to authenticate the user's credentials. To add the remote computer to the list of trusted hosts -in WS-Management, use the following command in the `WSMAN` provider, where `` +in WS-Management, use the following command in the `WSMan` provider, where `` is the name of the remote computer: `Set-Item -Path WSMan:\Localhost\Client\TrustedHosts -Value \` diff --git a/reference/7.4/Microsoft.PowerShell.Core/New-Module.md b/reference/7.4/Microsoft.PowerShell.Core/New-Module.md index 6e54d21801b5..9362098e95b6 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/New-Module.md +++ b/reference/7.4/Microsoft.PowerShell.Core/New-Module.md @@ -84,7 +84,7 @@ This example demonstrates that dynamic modules are not returned by the `Get-Modu members that they export are returned by the `Get-Command` cmdlet. ```powershell -new-module -scriptblock {function Hello {"Hello!"}} +New-Module -ScriptBlock {function Hello {"Hello!"}} ``` ```Output @@ -122,7 +122,7 @@ This example uses the `Export-ModuleMember` cmdlet to export a variable into the Without the `Export-ModuleMember` command, only the function is exported. ```powershell -New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($name) { "Hello, $name" }; Export-ModuleMember -function SayHello -Variable SayHelloHelp} +New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($Name) { "Hello, $Name" }; Export-ModuleMember -Function SayHello -Variable SayHelloHelp} $SayHelloHelp ``` @@ -151,7 +151,7 @@ return any objects by default, there is no output from this command. `Get-Module **GreetingModule** has been imported into the current session. ```powershell -New-Module -ScriptBlock {function Hello {"Hello!"}} -name GreetingModule | Import-Module +New-Module -ScriptBlock {function Hello {"Hello!"}} -Name GreetingModule | Import-Module Get-Module ``` @@ -173,7 +173,7 @@ NestedModules : {} ``` ```powershell -Get-Command hello +Get-Command Hello ``` ```Output @@ -196,8 +196,8 @@ The `$m` variable appears to have no assigned value. ```powershell $m = New-Module -ScriptBlock { - function Hello ($name) {"Hello, $name"} - function Goodbye ($name) {"Goodbye, $name"} + function Hello ($Name) {"Hello, $Name"} + function Goodbye ($Name) {"Goodbye, $Name"} } -AsCustomObject $m $m | Get-Member @@ -217,7 +217,7 @@ Hello ScriptMethod System.Object Hello(); ``` ```powershell -$m.goodbye("Jane") +$m.Goodbye("Jane") ``` ```Output @@ -225,7 +225,7 @@ Goodbye, Jane ``` ```powershell -$m.hello("Manoj") +$m.Hello("Manoj") ``` ```Output diff --git a/reference/7.4/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md b/reference/7.4/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md index 1af42d90c3af..587ff11ecdc2 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md +++ b/reference/7.4/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md @@ -29,8 +29,8 @@ New-PSRoleCapabilityFile [-Path] [-Guid ] [-Author ] [-De The `New-PSRoleCapabilityFile` cmdlet creates a file that defines a set of user capabilities that can be exposed through session configuration files. This includes determining which cmdlets, functions, and scripts are available to users. The capability file is a human-readable text file -that contains a hash table of session configuration properties and values. The file has a .psrc file -name extension, and can be used by more than one session configuration. +that contains a hash table of session configuration properties and values. The file has a `.psrc` +file name extension, and can be used by more than one session configuration. All the parameters of `New-PSRoleCapabilityFile` are optional except for the **Path** parameter, which specifies the path for the file. If you don't include a parameter when you run the cmdlet, the @@ -235,7 +235,7 @@ the following keys: For example: -`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process PowerShell};Options="AllScope"}` +`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process powershell};Options="AllScope"}` ```yaml Type: System.Collections.IDictionary[] diff --git a/reference/7.4/Microsoft.PowerShell.Core/New-PSSession.md b/reference/7.4/Microsoft.PowerShell.Core/New-PSSession.md index f014ea70ce2b..457bb89b1cd0 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/New-PSSession.md +++ b/reference/7.4/Microsoft.PowerShell.Core/New-PSSession.md @@ -182,7 +182,7 @@ the `$s` variable. It uses the credentials of the `Domain1\Admin01` user to comp ### Example 6: Create a session with a global scope in a different domain ```powershell -$global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 +$Global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 ``` This example shows how to create a **PSSession** with a global scope on a computer in a different @@ -215,7 +215,7 @@ text file, or other text-convertible format. ### Example 8: Create a session by using a URI ```powershell -$s = New-PSSession -URI http://Server01:91/NewSession -Credential Domain01\User01 +$s = New-PSSession -Uri http://Server01:91/NewSession -Credential Domain01\User01 ``` This command creates a **PSSession** on the Server01 computer and stores it in the `$s` variable. It @@ -227,7 +227,7 @@ that has permission to create a session on the remote computer. ```powershell $s = New-PSSession -ComputerName (Get-Content Servers.txt) -Credential Domain01\Admin01 -ThrottleLimit 16 -Invoke-Command -Session $s -ScriptBlock {Get-Process PowerShell} -AsJob +Invoke-Command -Session $s -ScriptBlock {Get-Process powershell} -AsJob ``` These commands create a set of **PSSession** objects and then run a background job in each of the @@ -244,7 +244,7 @@ command to `16` concurrent connections. The command saves the **PSSession** obje variable. The second command uses the **AsJob** parameter of the `Invoke-Command` cmdlet to start a background -job that runs a `Get-Process PowerShell` command in each of the **PSSession** objects in `$s`. +job that runs a `Get-Process powershell` command in each of the **PSSession** objects in `$s`. For more information about PowerShell background jobs, see [about_Jobs](About/about_Jobs.md) and [about_Remote_Jobs](About/about_Remote_Jobs.md). @@ -287,7 +287,7 @@ will have to use SSH key based user authentication. ### Example 13: Create a session using SSH and specify the port and user authentication key ```powershell -New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath c:\\userAKey_rsa +New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath C:\\userAKey_rsa ``` This example shows how to create a **PSSession** using Secure Shell (SSH). It uses the **Port** @@ -301,11 +301,11 @@ $sshConnections = @( @{ HostName = 'WinServer1' UserName = 'domain\userA' - KeyFilePath = 'c:\users\UserA\id_rsa' + KeyFilePath = 'C:\Users\UserA\id_rsa' } @{ HostName = 'UserB@LinuxServer5' - KeyFilePath = 'c:\UserB\\id_rsa' + KeyFilePath = 'C:\UserB\\id_rsa' } ) New-PSSession -SSHConnection $sshConnections diff --git a/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md b/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md index 8306e83e1dad..1cecdfc5ee22 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md +++ b/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md @@ -475,7 +475,7 @@ Accept wildcard characters: False ### -FormatsToProcess -Specifies the formatting files (.ps1xml) that run in sessions that use the session configuration. +Specifies the formatting files (`.ps1xml`) that run in sessions that use the session configuration. The value of this parameter must be a full or absolute path of the formatting files. ```yaml @@ -518,7 +518,7 @@ the following keys: values for this parameter are: None, ReadOnly, Constant, Private, or AllScope. For example: -`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process PowerShell};Options='AllScope'}` +`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process powershell};Options='AllScope'}` ```yaml Type: System.Collections.IDictionary[] @@ -646,10 +646,10 @@ Accept wildcard characters: False Configures sessions that use this session configuration to expose the `User:` PSDrive. User drives are unique for each connecting user and allow users to copy data to and from PowerShell endpoints -even if the File System provider is not exposed. User drive roots are created under -`$env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots\`. For each user connecting to the endpoint, a -folder is created with the name `$env:USERDOMAIN\$env:USERNAME`. For computers in workgroups, the -value of `$env:USERDOMAIN` is the hostname. +even if the FileSystem provider is not exposed. User drive roots are created under +`$Env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots\`. For each user connecting to the endpoint, a +folder is created with the name `$Env:USERDOMAIN\$Env:USERNAME`. For computers in workgroups, the +value of `$Env:USERDOMAIN` is the hostname. Contents in the user drive persist across user sessions and are not automatically removed. By default, users can only store up to 50MB of data in the user drive. This can be customized with the @@ -1073,7 +1073,7 @@ This cmdlet returns no output. value of the **VisibleProviders** parameter is the Certificate provider, but the **ModulesToImport** parameter does not specify the **Microsoft.PowerShell.Security** module that contains the Certificate provider, the Certificate provider is not visible in the session. -- `New-PSSessionConfigurationFile` creates a session configuration file that has a .pssc file name +- `New-PSSessionConfigurationFile` creates a session configuration file that has a `.pssc` file name extension in the path that you specify in the **Path** parameter. When you use the session configuration file to create a session configuration, the `Register-PSSessionConfiguration` cmdlet copies the configuration file and saves an active copy of the file in the **SessionConfig** diff --git a/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionOption.md b/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionOption.md index df9f6b1bf99a..80020ae12a64 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionOption.md +++ b/reference/7.4/Microsoft.PowerShell.Core/New-PSSessionOption.md @@ -88,7 +88,7 @@ IdleTimeout : 00:04:00 This example shows how to use a **SessionOption** object to configure a session. ```powershell -$pso = New-PSSessionOption -Culture "fr-fr" -MaximumReceivedObjectSize 10MB +$pso = New-PSSessionOption -Culture "fr-FR" -MaximumReceivedObjectSize 10MB New-PSSession -ComputerName Server01 -SessionOption $pso ``` @@ -138,7 +138,7 @@ TotalMilliseconds : 180000 ```powershell $a.UICulture = (Get-UICulture) -$a.OpenTimeout = (New-Timespan -Minutes 4) +$a.OpenTimeout = (New-TimeSpan -Minutes 4) $a.MaximumConnectionRedirectionCount = 1 $a ``` @@ -339,7 +339,7 @@ The idle time-out value is of significant importance if you intend to disconnect session. You can reconnect only if the session has not timed out. Enter a value in milliseconds. The minimum value is `60000` (1 minute). The maximum is the value of -the **MaxIdleTimeoutms** property of the session configuration. The default value, `-1`, does not +the **MaxIdleTimeoutMs** property of the session configuration. The default value, `-1`, does not set an idle time-out. The session uses the idle time-out that is set in the session options, if any. If none is set diff --git a/reference/7.4/Microsoft.PowerShell.Core/New-PSTransportOption.md b/reference/7.4/Microsoft.PowerShell.Core/New-PSTransportOption.md index b641c7509a6e..626eb4af1a5e 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/New-PSTransportOption.md +++ b/reference/7.4/Microsoft.PowerShell.Core/New-PSTransportOption.md @@ -101,7 +101,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 40 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 2 Name : ITTasks XmlRenderingType : text @@ -245,7 +245,7 @@ Accept wildcard characters: False ### -MaxIdleTimeoutSec -Limits the idle time-out set for each session to the specified value. The default value is `[Int]::MaxValue` +Limits the idle time-out set for each session to the specified value. The default value is `[int]::MaxValue` (~25 days). The idle time-out value is of significant importance when the user intends to disconnect and diff --git a/reference/7.4/Microsoft.PowerShell.Core/Receive-Job.md b/reference/7.4/Microsoft.PowerShell.Core/Receive-Job.md index 0a339ec81b22..062f7266db5a 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Receive-Job.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Receive-Job.md @@ -197,7 +197,7 @@ $s = New-PSSession -ComputerName Server01, Server02, Server03 $invokeCommandSplat = @{ Session = $s ScriptBlock = { - Start-Job -Name $('MyJob-' +$env:COMPUTERNAME) -ScriptBlock { + Start-Job -Name $('MyJob-' +$Env:COMPUTERNAME) -ScriptBlock { (Get-Date).ToString() } } @@ -224,7 +224,7 @@ Id Name State HasMoreData Location Command # variable and save the results in the $results variable. The Receive-Job command must be # run in each session because the jobs were run locally on each server. $results = Invoke-Command -Session $s -ScriptBlock { - Receive-Job -Name $('MyJob-' +$env:COMPUTERNAME) + Receive-Job -Name $('MyJob-' +$Env:COMPUTERNAME) } ``` diff --git a/reference/7.5/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md b/reference/7.5/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md index 81a878c5b8b1..9ee0e8b64eda 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md @@ -99,7 +99,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 300 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 1 Name : Full XmlRenderingType : text @@ -131,7 +131,7 @@ the content of the Plugin node. This is another way to look at the session confi computer. ```powershell -dir wsman:\localhost\plugin +dir WSMan:\localhost\plugin ``` ```Output @@ -208,7 +208,7 @@ Name PSVersion StartupScript Permission ---- --------- ------------- ---------- -------------- microsoft.powershell 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com microsoft.powershell32 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com -MyX86Shell 5.1 c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com +MyX86Shell 5.1 C:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com ``` The `Enable-WSManCredSSP` cmdlet enables **CredSSP** delegation on Server01, the local computer. The @@ -227,7 +227,7 @@ This example is useful for setting the value of the `$PSSessionConfigurationName variable, which takes a resource URI. ```powershell -(Get-PSSessionConfiguration -Name CustomShell).resourceURI +(Get-PSSessionConfiguration -Name CustomShell).ResourceUri ``` ```Output diff --git a/reference/7.5/Microsoft.PowerShell.Core/Import-Module.md b/reference/7.5/Microsoft.PowerShell.Core/Import-Module.md index 654bd50e47de..15d482c30af7 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Import-Module.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Import-Module.md @@ -107,8 +107,8 @@ Import-Module [-Global] [-Prefix ] [-Function ] [-Cmdlet Get-Module -ListAvailable PowerShellGet | Select-Object Path Path ---- C:\Program Files\PowerShell\Modules\PowerShellGet\2.2.1\PowerShellGet.psd1 -C:\program files\powershell\6\Modules\PowerShellGet\PowerShellGet.psd1 +C:\Program Files\PowerShell\6\Modules\PowerShellGet\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.2\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1 @@ -950,7 +950,7 @@ the module, such as a `.psd1`, `.psm1`, `.dll`, or `.ps1` file. File paths are o characters aren't permitted. You can also pipe module names and filenames to `Import-Module`. If you omit a path, `Import-Module` looks for the module in the paths saved in the -`$env:PSModulePath` environment variable. +`$Env:PSModulePath` environment variable. Specify only the module name whenever possible. When you specify a filename, only the members that are implemented in that file are imported. If the module contains other files, they aren't @@ -1143,7 +1143,7 @@ Accept wildcard characters: False Skips the check on the `CompatiblePSEditions` field. -Allows loading a module from the `"$($env:windir)\System32\WindowsPowerShell\v1.0\Modules"` module +Allows loading a module from the `"$($Env:windir)\System32\WindowsPowerShell\v1.0\Modules"` module directory into PowerShell Core when that module doesn't specify `Core` in the `CompatiblePSEditions` manifest field. @@ -1255,7 +1255,7 @@ PowerShell includes the following aliases for `Import-Module`: in the `PSModulePath` environmental variable. For more information, see [about_Modules](About/about_Modules.md). - You can also use the **PSSession** and **CIMSession** parameters to import modules that are + You can also use the **PSSession** and **CimSession** parameters to import modules that are installed on remote computers. However, commands that use the cmdlets in these modules run in the remote session on the remote computer. @@ -1296,7 +1296,7 @@ PowerShell includes the following aliases for `Import-Module`: To import a module that contains mixed-mode assemblies, start Windows PowerShell 2.0 by using the following command, and then try the `Import-Module` command again. - `PowerShell.exe -Version 2.0` + `powershell.exe -Version 2.0` - To use the CIM session feature, the remote computer must have WS-Management remoting and Windows Management Instrumentation (WMI), which is the Microsoft implementation of the Common Information diff --git a/reference/7.5/Microsoft.PowerShell.Core/Invoke-Command.md b/reference/7.5/Microsoft.PowerShell.Core/Invoke-Command.md index 5875a64cc73c..e12f5c33d2db 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Invoke-Command.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Invoke-Command.md @@ -200,7 +200,7 @@ Some code samples use splatting to reduce the line length. For more information, This example runs the `Test.ps1` script on the Server01 computer. ```powershell -Invoke-Command -FilePath c:\scripts\test.ps1 -ComputerName Server01 +Invoke-Command -FilePath C:\scripts\test.ps1 -ComputerName Server01 ``` The **FilePath** parameter specifies a script that is located on the local computer. The script runs @@ -250,10 +250,10 @@ This example compares the effects of using **ComputerName** and **Session** para data. ```powershell -Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process powershell } Invoke-Command -ComputerName Server02 -ScriptBlock { $p.VirtualMemorySize } $s = New-PSSession -ComputerName Server02 -Invoke-Command -Session $s -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -Session $s -ScriptBlock { $p = Get-Process powershell } Invoke-Command -Session $s -ScriptBlock { $p.VirtualMemorySize } ``` @@ -343,13 +343,13 @@ but the job exists on the local computer. The results are transmitted to the loc ```powershell $s = New-PSSession -ComputerName Server01, Server02 -Invoke-Command -Session $s -ScriptBlock { Get-EventLog system } -AsJob +Invoke-Command -Session $s -ScriptBlock { Get-EventLog System } -AsJob ``` ```Output Id Name State HasMoreData Location Command --- ---- ----- ----- ----------- --------------- -1 Job1 Running True Server01,Server02 Get-EventLog system +1 Job1 Running True Server01,Server02 Get-EventLog System ``` ```powershell @@ -361,7 +361,7 @@ $j | Format-List -Property * HasMoreData : True StatusMessage : Location : Server01,Server02 -Command : Get-EventLog system +Command : Get-EventLog System JobStateInfo : Running Finished : System.Threading.ManualResetEvent InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca @@ -394,9 +394,9 @@ the results in the `$results` variable. ### Example 9: Include local variables in a command run on a remote computer This example shows how to include the values of local variables in a command run on a remote -computer. The command uses the `Using` scope modifier to identify a local variable in a remote -command. By default, all variables are assumed to be defined in the remote session. The `Using` -scope modifier was introduced in PowerShell 3.0. For more information about the `Using` scope +computer. The command uses the `Using:` scope modifier to identify a local variable in a remote +command. By default, all variables are assumed to be defined in the remote session. The `Using:` +scope modifier was introduced in PowerShell 3.0. For more information about the `Using:` scope modifier, see [about_Remote_Variables](About/about_Remote_Variables.md) and [about_Scopes](About/about_scopes.md). @@ -409,7 +409,7 @@ Invoke-Command -ComputerName Server01 -ScriptBlock { The `$Log` variable stores the name of the event log, PowerShellCore/Operational. The `Invoke-Command` cmdlet runs `Get-WinEvent` on Server01 to get the ten newest events from the event -log. The value of the **LogName** parameter is the `$Log` variable that is prefixed by the `Using` +log. The value of the **LogName** parameter is the `$Log` variable that is prefixed by the `Using:` scope modifier to indicate that it was created in the local session, not in the remote session. ### Example 10: Hide the computer name @@ -420,7 +420,7 @@ display. You can still use the **Format** cmdlets to display the **PsComputerNam of the affected objects. ```powershell -Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process PowerShell } +Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process powershell } ``` ```Output @@ -432,7 +432,7 @@ S2 777 14 35100 30988 150 3.68 67 Po ```powershell Invoke-Command -ComputerName S1, S2 -HideComputerName -ScriptBlock { - Get-Process PowerShell + Get-Process powershell } ``` @@ -448,21 +448,21 @@ process. The output of the first command includes the **PsComputerName** propert the name of the computer on which the command ran. The output of the second command, which uses **HideComputerName**, doesn't include the **PsComputerName** column. -### Example 11: Use the Param keyword in a script block +### Example 11: Use the `param` keyword in a script block -The `Param` keyword and the **ArgumentList** parameter are used to pass variable values to named +The `param` keyword and the **ArgumentList** parameter are used to pass variable values to named parameters in a script block. This example displays filenames that begin with the letter `a` and have the `.pdf` extension. -For more information about the `Param` keyword, see +For more information about the `param` keyword, see [about_Language_Keywords](About/about_language_keywords.md#param). ```powershell $parameters = @{ ComputerName = 'Server01' ScriptBlock = { - Param ($param1, $param2) - Get-ChildItem -Name $param1 -Include $param2 + param ($Param1, $Param2) + Get-ChildItem -Name $Param1 -Include $Param2 } ArgumentList = 'a*', '*.pdf' } @@ -476,8 +476,8 @@ ac.pdf az.pdf ``` -`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$param1` and -`$param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable +`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$Param1` and +`$Param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable names. The **ArgumentList** passes the values to the variables. ### Example 12: Use the $args automatic variable in a script block @@ -732,7 +732,7 @@ $sshConnections = @( KeyFilePath = "/Users/UserB/id_rsa" } ) -$results = Invoke-Command -FilePath c:\Scripts\GetInfo.ps1 -SSHConnection $sshConnections +$results = Invoke-Command -FilePath C:\Scripts\GetInfo.ps1 -SSHConnection $sshConnections ``` ### Example 22: Connect to a remote SSH session using SSH options @@ -747,7 +747,7 @@ $options = @{ User = 'UserB' Host = 'LinuxServer5' } -$results = Invoke-Command -FilePath c:\Scripts\CollectEvents.ps1 -KeyFilePath '/Users/UserB/id_rsa' -Options $options +$results = Invoke-Command -FilePath C:\Scripts\CollectEvents.ps1 -KeyFilePath '/Users/UserB/id_rsa' -Options $options ``` ## PARAMETERS @@ -1730,7 +1730,7 @@ on a single computer. If the remote computer isn't in a domain that the local computer trusts, the computer might not be able to authenticate the user's credentials. To add the remote computer to the list of trusted hosts -in WS-Management, use the following command in the `WSMAN` provider, where `` +in WS-Management, use the following command in the `WSMan` provider, where `` is the name of the remote computer: `Set-Item -Path WSMan:\Localhost\Client\TrustedHosts -Value \` diff --git a/reference/7.5/Microsoft.PowerShell.Core/New-Module.md b/reference/7.5/Microsoft.PowerShell.Core/New-Module.md index 224ac424cb08..0360e6583771 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/New-Module.md +++ b/reference/7.5/Microsoft.PowerShell.Core/New-Module.md @@ -84,7 +84,7 @@ This example demonstrates that dynamic modules are not returned by the `Get-Modu members that they export are returned by the `Get-Command` cmdlet. ```powershell -new-module -scriptblock {function Hello {"Hello!"}} +New-Module -ScriptBlock {function Hello {"Hello!"}} ``` ```Output @@ -122,7 +122,7 @@ This example uses the `Export-ModuleMember` cmdlet to export a variable into the Without the `Export-ModuleMember` command, only the function is exported. ```powershell -New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($name) { "Hello, $name" }; Export-ModuleMember -Function SayHello -Variable SayHelloHelp} +New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($Name) { "Hello, $Name" }; Export-ModuleMember -Function SayHello -Variable SayHelloHelp} $SayHelloHelp ``` @@ -173,7 +173,7 @@ NestedModules : {} ``` ```powershell -Get-Command hello +Get-Command Hello ``` ```Output @@ -196,8 +196,8 @@ The `$m` variable appears to have no assigned value. ```powershell $m = New-Module -ScriptBlock { - function Hello ($name) {"Hello, $name"} - function Goodbye ($name) {"Goodbye, $name"} + function Hello ($Name) {"Hello, $Name"} + function Goodbye ($Name) {"Goodbye, $Name"} } -AsCustomObject $m $m | Get-Member @@ -217,7 +217,7 @@ Hello ScriptMethod System.Object Hello(); ``` ```powershell -$m.goodbye("Jane") +$m.Goodbye("Jane") ``` ```Output @@ -225,7 +225,7 @@ Goodbye, Jane ``` ```powershell -$m.hello("Manoj") +$m.Hello("Manoj") ``` ```Output diff --git a/reference/7.5/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md b/reference/7.5/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md index 7dc378add802..93980f46ac21 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md +++ b/reference/7.5/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md @@ -29,8 +29,8 @@ New-PSRoleCapabilityFile [-Path] [-Guid ] [-Author ] [-De The `New-PSRoleCapabilityFile` cmdlet creates a file that defines a set of user capabilities that can be exposed through session configuration files. This includes determining which cmdlets, functions, and scripts are available to users. The capability file is a human-readable text file -that contains a hash table of session configuration properties and values. The file has a .psrc file -name extension, and can be used by more than one session configuration. +that contains a hash table of session configuration properties and values. The file has a `.psrc` +file name extension, and can be used by more than one session configuration. All the parameters of `New-PSRoleCapabilityFile` are optional except for the **Path** parameter, which specifies the path for the file. If you don't include a parameter when you run the cmdlet, the @@ -235,7 +235,7 @@ the following keys: For example: -`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process PowerShell};Options="AllScope"}` +`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process powershell};Options="AllScope"}` ```yaml Type: System.Collections.IDictionary[] diff --git a/reference/7.5/Microsoft.PowerShell.Core/New-PSSession.md b/reference/7.5/Microsoft.PowerShell.Core/New-PSSession.md index 1b35c7a6c1d1..b0a16fb9c66e 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/New-PSSession.md +++ b/reference/7.5/Microsoft.PowerShell.Core/New-PSSession.md @@ -182,7 +182,7 @@ the `$s` variable. It uses the credentials of the `Domain1\Admin01` user to comp ### Example 6: Create a session with a global scope in a different domain ```powershell -$global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 +$Global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 ``` This example shows how to create a **PSSession** with a global scope on a computer in a different @@ -215,7 +215,7 @@ text file, or other text-convertible format. ### Example 8: Create a session by using a URI ```powershell -$s = New-PSSession -URI http://Server01:91/NewSession -Credential Domain01\User01 +$s = New-PSSession -Uri http://Server01:91/NewSession -Credential Domain01\User01 ``` This command creates a **PSSession** on the Server01 computer and stores it in the `$s` variable. It @@ -227,7 +227,7 @@ that has permission to create a session on the remote computer. ```powershell $s = New-PSSession -ComputerName (Get-Content Servers.txt) -Credential Domain01\Admin01 -ThrottleLimit 16 -Invoke-Command -Session $s -ScriptBlock {Get-Process PowerShell} -AsJob +Invoke-Command -Session $s -ScriptBlock {Get-Process powershell} -AsJob ``` These commands create a set of **PSSession** objects and then run a background job in each of the @@ -244,7 +244,7 @@ command to `16` concurrent connections. The command saves the **PSSession** obje variable. The second command uses the **AsJob** parameter of the `Invoke-Command` cmdlet to start a background -job that runs a `Get-Process PowerShell` command in each of the **PSSession** objects in `$s`. +job that runs a `Get-Process powershell` command in each of the **PSSession** objects in `$s`. For more information about PowerShell background jobs, see [about_Jobs](About/about_Jobs.md) and [about_Remote_Jobs](About/about_Remote_Jobs.md). @@ -287,7 +287,7 @@ will have to use SSH key based user authentication. ### Example 13: Create a session using SSH and specify the port and user authentication key ```powershell -New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath c:\\userAKey_rsa +New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath C:\\userAKey_rsa ``` This example shows how to create a **PSSession** using Secure Shell (SSH). It uses the **Port** @@ -301,11 +301,11 @@ $sshConnections = @( @{ HostName = 'WinServer1' UserName = 'domain\userA' - KeyFilePath = 'c:\users\UserA\id_rsa' + KeyFilePath = 'C:\Users\UserA\id_rsa' } @{ HostName = 'UserB@LinuxServer5' - KeyFilePath = 'c:\UserB\\id_rsa' + KeyFilePath = 'C:\UserB\\id_rsa' } ) New-PSSession -SSHConnection $sshConnections diff --git a/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md b/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md index 3527f0408d63..a3dcbc1d2136 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md +++ b/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md @@ -479,7 +479,7 @@ Accept wildcard characters: False ### -FormatsToProcess -Specifies the formatting files (.ps1xml) that run in sessions that use the session configuration. +Specifies the formatting files (`.ps1xml`) that run in sessions that use the session configuration. The value of this parameter must be a full or absolute path of the formatting files. ```yaml @@ -522,7 +522,7 @@ the following keys: values for this parameter are: None, ReadOnly, Constant, Private, or AllScope. For example: -`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process PowerShell};Options='AllScope'}` +`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process powershell};Options='AllScope'}` ```yaml Type: System.Collections.IDictionary[] @@ -650,10 +650,10 @@ Accept wildcard characters: False Configures sessions that use this session configuration to expose the `User:` PSDrive. User drives are unique for each connecting user and allow users to copy data to and from PowerShell endpoints -even if the File System provider is not exposed. User drive roots are created under -`$env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots\`. For each user connecting to the endpoint, a -folder is created with the name `$env:USERDOMAIN\$env:USERNAME`. For computers in workgroups, the -value of `$env:USERDOMAIN` is the hostname. +even if the FileSystem provider is not exposed. User drive roots are created under +`$Env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots\`. For each user connecting to the endpoint, a +folder is created with the name `$Env:USERDOMAIN\$Env:USERNAME`. For computers in workgroups, the +value of `$Env:USERDOMAIN` is the hostname. Contents in the user drive persist across user sessions and are not automatically removed. By default, users can only store up to 50MB of data in the user drive. This can be customized with the @@ -1077,7 +1077,7 @@ This cmdlet returns no output. value of the **VisibleProviders** parameter is the Certificate provider, but the **ModulesToImport** parameter does not specify the **Microsoft.PowerShell.Security** module that contains the Certificate provider, the Certificate provider is not visible in the session. -- `New-PSSessionConfigurationFile` creates a session configuration file that has a .pssc file name +- `New-PSSessionConfigurationFile` creates a session configuration file that has a `.pssc` file name extension in the path that you specify in the **Path** parameter. When you use the session configuration file to create a session configuration, the `Register-PSSessionConfiguration` cmdlet copies the configuration file and saves an active copy of the file in the **SessionConfig** diff --git a/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionOption.md b/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionOption.md index 203f78500a72..b2f19594dea2 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionOption.md +++ b/reference/7.5/Microsoft.PowerShell.Core/New-PSSessionOption.md @@ -88,7 +88,7 @@ IdleTimeout : 00:04:00 This example shows how to use a **SessionOption** object to configure a session. ```powershell -$pso = New-PSSessionOption -Culture "fr-fr" -MaximumReceivedObjectSize 10MB +$pso = New-PSSessionOption -Culture "fr-FR" -MaximumReceivedObjectSize 10MB New-PSSession -ComputerName Server01 -SessionOption $pso ``` @@ -138,7 +138,7 @@ TotalMilliseconds : 180000 ```powershell $a.UICulture = (Get-UICulture) -$a.OpenTimeout = (New-Timespan -Minutes 4) +$a.OpenTimeout = (New-TimeSpan -Minutes 4) $a.MaximumConnectionRedirectionCount = 1 $a ``` diff --git a/reference/7.5/Microsoft.PowerShell.Core/New-PSTransportOption.md b/reference/7.5/Microsoft.PowerShell.Core/New-PSTransportOption.md index 2fb4661b303f..036c7e533419 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/New-PSTransportOption.md +++ b/reference/7.5/Microsoft.PowerShell.Core/New-PSTransportOption.md @@ -101,7 +101,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 40 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 2 Name : ITTasks XmlRenderingType : text @@ -247,7 +247,7 @@ Accept wildcard characters: False ### -MaxIdleTimeoutSec Limits the idle time-out set for each session to the specified value. The default value is -`[Int]::MaxValue` (~25 days). +`[int]::MaxValue` (~25 days). The idle time-out value is of significant importance when the user intends to disconnect and reconnect to a session. The user can reconnect only if the session has not timed out. diff --git a/reference/7.5/Microsoft.PowerShell.Core/Receive-Job.md b/reference/7.5/Microsoft.PowerShell.Core/Receive-Job.md index 6fb18a48bb6c..74f9186fba83 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Receive-Job.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Receive-Job.md @@ -197,7 +197,7 @@ $s = New-PSSession -ComputerName Server01, Server02, Server03 $invokeCommandSplat = @{ Session = $s ScriptBlock = { - Start-Job -Name $('MyJob-' +$env:COMPUTERNAME) -ScriptBlock { + Start-Job -Name $('MyJob-' +$Env:COMPUTERNAME) -ScriptBlock { (Get-Date).ToString() } } @@ -224,7 +224,7 @@ Id Name State HasMoreData Location Command # variable and save the results in the $results variable. The Receive-Job command must be # run in each session because the jobs were run locally on each server. $results = Invoke-Command -Session $s -ScriptBlock { - Receive-Job -Name $('MyJob-' +$env:COMPUTERNAME) + Receive-Job -Name $('MyJob-' +$Env:COMPUTERNAME) } ``` diff --git a/reference/7.6/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md b/reference/7.6/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md index 3538d2d8178f..e198853f3c4f 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Get-PSSessionConfiguration.md @@ -98,7 +98,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 300 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 1 Name : Full XmlRenderingType : text @@ -129,7 +129,7 @@ the content of the Plugin node. This is another way to look at the session confi computer. ```powershell -dir wsman:\localhost\plugin +dir WSMan:\localhost\plugin ``` ```Output @@ -206,7 +206,7 @@ Name PSVersion StartupScript Permission ---- --------- ------------- ---------- -------------- microsoft.powershell 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com microsoft.powershell32 5.1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com -MyX86Shell 5.1 c:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com +MyX86Shell 5.1 C:\test\x86Shell.ps1 BUILTIN\Administrators AccessAll... server02.corp.fabrikam.com ``` The `Enable-WSManCredSSP` cmdlet enables **CredSSP** delegation on Server01, the local computer. The @@ -225,7 +225,7 @@ This example is useful for setting the value of the `$PSSessionConfigurationName variable, which takes a resource URI. ```powershell -(Get-PSSessionConfiguration -Name CustomShell).resourceURI +(Get-PSSessionConfiguration -Name CustomShell).ResourceUri ``` ```Output diff --git a/reference/7.6/Microsoft.PowerShell.Core/Import-Module.md b/reference/7.6/Microsoft.PowerShell.Core/Import-Module.md index 3372f109a8be..361d8d089572 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Import-Module.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Import-Module.md @@ -107,8 +107,8 @@ Import-Module [-Global] [-Prefix ] [-Function ] [-Cmdlet Get-Module -ListAvailable PowerShellGet | Select-Object Path Path ---- C:\Program Files\PowerShell\Modules\PowerShellGet\2.2.1\PowerShellGet.psd1 -C:\program files\powershell\6\Modules\PowerShellGet\PowerShellGet.psd1 +C:\Program Files\PowerShell\6\Modules\PowerShellGet\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.2\PowerShellGet.psd1 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1 @@ -950,7 +950,7 @@ the module, such as a `.psd1`, `.psm1`, `.dll`, or `.ps1` file. File paths are o characters aren't permitted. You can also pipe module names and filenames to `Import-Module`. If you omit a path, `Import-Module` looks for the module in the paths saved in the -`$env:PSModulePath` environment variable. +`$Env:PSModulePath` environment variable. Specify only the module name whenever possible. When you specify a filename, only the members that are implemented in that file are imported. If the module contains other files, they aren't @@ -1143,7 +1143,7 @@ Accept wildcard characters: False Skips the check on the `CompatiblePSEditions` field. -Allows loading a module from the `"$($env:windir)\System32\WindowsPowerShell\v1.0\Modules"` module +Allows loading a module from the `"$($Env:windir)\System32\WindowsPowerShell\v1.0\Modules"` module directory into PowerShell Core when that module doesn't specify `Core` in the `CompatiblePSEditions` manifest field. @@ -1255,7 +1255,7 @@ PowerShell includes the following aliases for `Import-Module`: in the `PSModulePath` environmental variable. For more information, see [about_Modules](About/about_Modules.md). - You can also use the **PSSession** and **CIMSession** parameters to import modules that are + You can also use the **PSSession** and **CimSession** parameters to import modules that are installed on remote computers. However, commands that use the cmdlets in these modules run in the remote session on the remote computer. @@ -1296,7 +1296,7 @@ PowerShell includes the following aliases for `Import-Module`: To import a module that contains mixed-mode assemblies, start Windows PowerShell 2.0 by using the following command, and then try the `Import-Module` command again. - `PowerShell.exe -Version 2.0` + `powershell.exe -Version 2.0` - To use the CIM session feature, the remote computer must have WS-Management remoting and Windows Management Instrumentation (WMI), which is the Microsoft implementation of the Common Information diff --git a/reference/7.6/Microsoft.PowerShell.Core/Invoke-Command.md b/reference/7.6/Microsoft.PowerShell.Core/Invoke-Command.md index 98caa1d4855d..3756bb48711f 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Invoke-Command.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Invoke-Command.md @@ -200,7 +200,7 @@ Some code samples use splatting to reduce the line length. For more information, This example runs the `Test.ps1` script on the Server01 computer. ```powershell -Invoke-Command -FilePath c:\scripts\test.ps1 -ComputerName Server01 +Invoke-Command -FilePath C:\scripts\test.ps1 -ComputerName Server01 ``` The **FilePath** parameter specifies a script that is located on the local computer. The script runs @@ -250,10 +250,10 @@ This example compares the effects of using **ComputerName** and **Session** para data. ```powershell -Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -ComputerName Server02 -ScriptBlock { $p = Get-Process powershell } Invoke-Command -ComputerName Server02 -ScriptBlock { $p.VirtualMemorySize } $s = New-PSSession -ComputerName Server02 -Invoke-Command -Session $s -ScriptBlock { $p = Get-Process PowerShell } +Invoke-Command -Session $s -ScriptBlock { $p = Get-Process powershell } Invoke-Command -Session $s -ScriptBlock { $p.VirtualMemorySize } ``` @@ -343,13 +343,13 @@ but the job exists on the local computer. The results are transmitted to the loc ```powershell $s = New-PSSession -ComputerName Server01, Server02 -Invoke-Command -Session $s -ScriptBlock { Get-EventLog system } -AsJob +Invoke-Command -Session $s -ScriptBlock { Get-EventLog System } -AsJob ``` ```Output Id Name State HasMoreData Location Command --- ---- ----- ----- ----------- --------------- -1 Job1 Running True Server01,Server02 Get-EventLog system +1 Job1 Running True Server01,Server02 Get-EventLog System ``` ```powershell @@ -361,7 +361,7 @@ $j | Format-List -Property * HasMoreData : True StatusMessage : Location : Server01,Server02 -Command : Get-EventLog system +Command : Get-EventLog System JobStateInfo : Running Finished : System.Threading.ManualResetEvent InstanceId : e124bb59-8cb2-498b-a0d2-2e07d4e030ca @@ -394,9 +394,9 @@ the results in the `$results` variable. ### Example 9: Include local variables in a command run on a remote computer This example shows how to include the values of local variables in a command run on a remote -computer. The command uses the `Using` scope modifier to identify a local variable in a remote -command. By default, all variables are assumed to be defined in the remote session. The `Using` -scope modifier was introduced in PowerShell 3.0. For more information about the `Using` scope +computer. The command uses the `Using:` scope modifier to identify a local variable in a remote +command. By default, all variables are assumed to be defined in the remote session. The `Using:` +scope modifier was introduced in PowerShell 3.0. For more information about the `Using:` scope modifier, see [about_Remote_Variables](./About/about_Remote_Variables.md) and [about_Scopes](./about/about_scopes.md). @@ -409,7 +409,7 @@ Invoke-Command -ComputerName Server01 -ScriptBlock { The `$Log` variable stores the name of the event log, PowerShellCore/Operational. The `Invoke-Command` cmdlet runs `Get-WinEvent` on Server01 to get the ten newest events from the event -log. The value of the **LogName** parameter is the `$Log` variable that is prefixed by the `Using` +log. The value of the **LogName** parameter is the `$Log` variable that is prefixed by the `Using:` scope modifier to indicate that it was created in the local session, not in the remote session. ### Example 10: Hide the computer name @@ -420,7 +420,7 @@ display. You can still use the **Format** cmdlets to display the **PsComputerNam of the affected objects. ```powershell -Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process PowerShell } +Invoke-Command -ComputerName S1, S2 -ScriptBlock { Get-Process powershell } ``` ```Output @@ -432,7 +432,7 @@ S2 777 14 35100 30988 150 3.68 67 Po ```powershell Invoke-Command -ComputerName S1, S2 -HideComputerName -ScriptBlock { - Get-Process PowerShell + Get-Process powershell } ``` @@ -448,21 +448,21 @@ process. The output of the first command includes the **PsComputerName** propert the name of the computer on which the command ran. The output of the second command, which uses **HideComputerName**, doesn't include the **PsComputerName** column. -### Example 11: Use the Param keyword in a script block +### Example 11: Use the `param` keyword in a script block -The `Param` keyword and the **ArgumentList** parameter are used to pass variable values to named +The `param` keyword and the **ArgumentList** parameter are used to pass variable values to named parameters in a script block. This example displays filenames that begin with the letter `a` and have the `.pdf` extension. -For more information about the `Param` keyword, see +For more information about the `param` keyword, see [about_Language_Keywords](./about/about_language_keywords.md#param). ```powershell $parameters = @{ ComputerName = 'Server01' ScriptBlock = { - Param ($param1, $param2) - Get-ChildItem -Name $param1 -Include $param2 + param ($Param1, $Param2) + Get-ChildItem -Name $Param1 -Include $Param2 } ArgumentList = 'a*', '*.pdf' } @@ -476,8 +476,8 @@ ac.pdf az.pdf ``` -`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$param1` and -`$param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable +`Invoke-Command` uses the **ScriptBlock** parameter that defines two variables, `$Param1` and +`$Param2`. `Get-ChildItem` uses the named parameters, **Name** and **Include** with the variable names. The **ArgumentList** passes the values to the variables. ### Example 12: Use the $args automatic variable in a script block @@ -732,7 +732,7 @@ $sshConnections = @( KeyFilePath = "/Users/UserB/id_rsa" } ) -$results = Invoke-Command -FilePath c:\Scripts\GetInfo.ps1 -SSHConnection $sshConnections +$results = Invoke-Command -FilePath C:\Scripts\GetInfo.ps1 -SSHConnection $sshConnections ``` ### Example 22: Connect to a remote SSH session using SSH options @@ -747,7 +747,7 @@ $options = @{ User = 'UserB' Host = 'LinuxServer5' } -$results = Invoke-Command -FilePath c:\Scripts\CollectEvents.ps1 -KeyFilePath '/Users/UserB/id_rsa' -Options $options +$results = Invoke-Command -FilePath C:\Scripts\CollectEvents.ps1 -KeyFilePath '/Users/UserB/id_rsa' -Options $options ``` ## PARAMETERS @@ -1730,7 +1730,7 @@ on a single computer. If the remote computer isn't in a domain that the local computer trusts, the computer might not be able to authenticate the user's credentials. To add the remote computer to the list of trusted hosts -in WS-Management, use the following command in the `WSMAN` provider, where `` +in WS-Management, use the following command in the `WSMan` provider, where `` is the name of the remote computer: `Set-Item -Path WSMan:\Localhost\Client\TrustedHosts -Value \` diff --git a/reference/7.6/Microsoft.PowerShell.Core/New-Module.md b/reference/7.6/Microsoft.PowerShell.Core/New-Module.md index cd1b389f1c83..17b7a26ec53f 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/New-Module.md +++ b/reference/7.6/Microsoft.PowerShell.Core/New-Module.md @@ -84,7 +84,7 @@ This example demonstrates that dynamic modules are not returned by the `Get-Modu members that they export are returned by the `Get-Command` cmdlet. ```powershell -new-module -scriptblock {function Hello {"Hello!"}} +New-Module -ScriptBlock {function Hello {"Hello!"}} ``` ```Output @@ -122,7 +122,7 @@ This example uses the `Export-ModuleMember` cmdlet to export a variable into the Without the `Export-ModuleMember` command, only the function is exported. ```powershell -New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($name) { "Hello, $name" }; Export-ModuleMember -function SayHello -Variable SayHelloHelp} +New-Module -ScriptBlock {$SayHelloHelp="Type 'SayHello', a space, and a name."; function SayHello ($Name) { "Hello, $Name" }; Export-ModuleMember -Function SayHello -Variable SayHelloHelp} $SayHelloHelp ``` @@ -151,7 +151,7 @@ return any objects by default, there is no output from this command. `Get-Module **GreetingModule** has been imported into the current session. ```powershell -New-Module -ScriptBlock {function Hello {"Hello!"}} -name GreetingModule | Import-Module +New-Module -ScriptBlock {function Hello {"Hello!"}} -Name GreetingModule | Import-Module Get-Module ``` @@ -173,7 +173,7 @@ NestedModules : {} ``` ```powershell -Get-Command hello +Get-Command Hello ``` ```Output @@ -196,8 +196,8 @@ The `$m` variable appears to have no assigned value. ```powershell $m = New-Module -ScriptBlock { - function Hello ($name) {"Hello, $name"} - function Goodbye ($name) {"Goodbye, $name"} + function Hello ($Name) {"Hello, $Name"} + function Goodbye ($Name) {"Goodbye, $Name"} } -AsCustomObject $m $m | Get-Member @@ -217,7 +217,7 @@ Hello ScriptMethod System.Object Hello(); ``` ```powershell -$m.goodbye("Jane") +$m.Goodbye("Jane") ``` ```Output @@ -225,7 +225,7 @@ Goodbye, Jane ``` ```powershell -$m.hello("Manoj") +$m.Hello("Manoj") ``` ```Output diff --git a/reference/7.6/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md b/reference/7.6/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md index b15a4b818922..e49098944e0f 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md +++ b/reference/7.6/Microsoft.PowerShell.Core/New-PSRoleCapabilityFile.md @@ -29,8 +29,8 @@ New-PSRoleCapabilityFile [-Path] [-Guid ] [-Author ] [-De The `New-PSRoleCapabilityFile` cmdlet creates a file that defines a set of user capabilities that can be exposed through session configuration files. This includes determining which cmdlets, functions, and scripts are available to users. The capability file is a human-readable text file -that contains a hash table of session configuration properties and values. The file has a .psrc file -name extension, and can be used by more than one session configuration. +that contains a hash table of session configuration properties and values. The file has a `.psrc` +file name extension, and can be used by more than one session configuration. All the parameters of `New-PSRoleCapabilityFile` are optional except for the **Path** parameter, which specifies the path for the file. If you don't include a parameter when you run the cmdlet, the @@ -235,7 +235,7 @@ the following keys: For example: -`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process PowerShell};Options="AllScope"}` +`@{Name="Get-PowerShellProcess";ScriptBlock={Get-Process powershell};Options="AllScope"}` ```yaml Type: System.Collections.IDictionary[] diff --git a/reference/7.6/Microsoft.PowerShell.Core/New-PSSession.md b/reference/7.6/Microsoft.PowerShell.Core/New-PSSession.md index 406f618ce60c..a0b826f55dec 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/New-PSSession.md +++ b/reference/7.6/Microsoft.PowerShell.Core/New-PSSession.md @@ -182,7 +182,7 @@ the `$s` variable. It uses the credentials of the `Domain1\Admin01` user to comp ### Example 6: Create a session with a global scope in a different domain ```powershell -$global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 +$Global:s = New-PSSession -ComputerName Server1.Domain44.Corpnet.Fabrikam.com -Credential Domain01\Admin01 ``` This example shows how to create a **PSSession** with a global scope on a computer in a different @@ -215,7 +215,7 @@ text file, or other text-convertible format. ### Example 8: Create a session by using a URI ```powershell -$s = New-PSSession -URI http://Server01:91/NewSession -Credential Domain01\User01 +$s = New-PSSession -Uri http://Server01:91/NewSession -Credential Domain01\User01 ``` This command creates a **PSSession** on the Server01 computer and stores it in the `$s` variable. It @@ -227,7 +227,7 @@ that has permission to create a session on the remote computer. ```powershell $s = New-PSSession -ComputerName (Get-Content Servers.txt) -Credential Domain01\Admin01 -ThrottleLimit 16 -Invoke-Command -Session $s -ScriptBlock {Get-Process PowerShell} -AsJob +Invoke-Command -Session $s -ScriptBlock {Get-Process powershell} -AsJob ``` These commands create a set of **PSSession** objects and then run a background job in each of the @@ -244,7 +244,7 @@ command to `16` concurrent connections. The command saves the **PSSession** obje variable. The second command uses the **AsJob** parameter of the `Invoke-Command` cmdlet to start a background -job that runs a `Get-Process PowerShell` command in each of the **PSSession** objects in `$s`. +job that runs a `Get-Process powershell` command in each of the **PSSession** objects in `$s`. For more information about PowerShell background jobs, see [about_Jobs](About/about_Jobs.md) and [about_Remote_Jobs](About/about_Remote_Jobs.md). @@ -287,7 +287,7 @@ will have to use SSH key based user authentication. ### Example 13: Create a session using SSH and specify the port and user authentication key ```powershell -New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath c:\\userAKey_rsa +New-PSSession -HostName UserA@LinuxServer01:22 -KeyFilePath C:\\userAKey_rsa ``` This example shows how to create a **PSSession** using Secure Shell (SSH). It uses the **Port** @@ -301,11 +301,11 @@ $sshConnections = @( @{ HostName = 'WinServer1' UserName = 'domain\userA' - KeyFilePath = 'c:\users\UserA\id_rsa' + KeyFilePath = 'C:\Users\UserA\id_rsa' } @{ HostName = 'UserB@LinuxServer5' - KeyFilePath = 'c:\UserB\\id_rsa' + KeyFilePath = 'C:\UserB\\id_rsa' } ) New-PSSession -SSHConnection $sshConnections diff --git a/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md b/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md index c08ccd116382..05aad6afaf41 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md +++ b/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionConfigurationFile.md @@ -475,7 +475,7 @@ Accept wildcard characters: False ### -FormatsToProcess -Specifies the formatting files (.ps1xml) that run in sessions that use the session configuration. +Specifies the formatting files (`.ps1xml`) that run in sessions that use the session configuration. The value of this parameter must be a full or absolute path of the formatting files. ```yaml @@ -518,7 +518,7 @@ the following keys: values for this parameter are: None, ReadOnly, Constant, Private, or AllScope. For example: -`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process PowerShell};Options='AllScope'}` +`@{Name='Get-PowerShellProcess';ScriptBlock={Get-Process powershell};Options='AllScope'}` ```yaml Type: System.Collections.IDictionary[] @@ -646,10 +646,10 @@ Accept wildcard characters: False Configures sessions that use this session configuration to expose the `User:` PSDrive. User drives are unique for each connecting user and allow users to copy data to and from PowerShell endpoints -even if the File System provider is not exposed. User drive roots are created under -`$env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots\`. For each user connecting to the endpoint, a -folder is created with the name `$env:USERDOMAIN\$env:USERNAME`. For computers in workgroups, the -value of `$env:USERDOMAIN` is the hostname. +even if the FileSystem provider is not exposed. User drive roots are created under +`$Env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots\`. For each user connecting to the endpoint, a +folder is created with the name `$Env:USERDOMAIN\$Env:USERNAME`. For computers in workgroups, the +value of `$Env:USERDOMAIN` is the hostname. Contents in the user drive persist across user sessions and are not automatically removed. By default, users can only store up to 50MB of data in the user drive. This can be customized with the @@ -1073,7 +1073,7 @@ This cmdlet returns no output. value of the **VisibleProviders** parameter is the Certificate provider, but the **ModulesToImport** parameter does not specify the **Microsoft.PowerShell.Security** module that contains the Certificate provider, the Certificate provider is not visible in the session. -- `New-PSSessionConfigurationFile` creates a session configuration file that has a .pssc file name +- `New-PSSessionConfigurationFile` creates a session configuration file that has a `.pssc` file name extension in the path that you specify in the **Path** parameter. When you use the session configuration file to create a session configuration, the `Register-PSSessionConfiguration` cmdlet copies the configuration file and saves an active copy of the file in the **SessionConfig** diff --git a/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionOption.md b/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionOption.md index 8672a06d8cc2..0773f2a32dee 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionOption.md +++ b/reference/7.6/Microsoft.PowerShell.Core/New-PSSessionOption.md @@ -88,7 +88,7 @@ IdleTimeout : 00:04:00 This example shows how to use a **SessionOption** object to configure a session. ```powershell -$pso = New-PSSessionOption -Culture "fr-fr" -MaximumReceivedObjectSize 10MB +$pso = New-PSSessionOption -Culture "fr-FR" -MaximumReceivedObjectSize 10MB New-PSSession -ComputerName Server01 -SessionOption $pso ``` @@ -138,7 +138,7 @@ TotalMilliseconds : 180000 ```powershell $a.UICulture = (Get-UICulture) -$a.OpenTimeout = (New-Timespan -Minutes 4) +$a.OpenTimeout = (New-TimeSpan -Minutes 4) $a.MaximumConnectionRedirectionCount = 1 $a ``` @@ -339,7 +339,7 @@ The idle time-out value is of significant importance if you intend to disconnect session. You can reconnect only if the session has not timed out. Enter a value in milliseconds. The minimum value is `60000` (1 minute). The maximum is the value of -the **MaxIdleTimeoutms** property of the session configuration. The default value, `-1`, does not +the **MaxIdleTimeoutMs** property of the session configuration. The default value, `-1`, does not set an idle time-out. The session uses the idle time-out that is set in the session options, if any. If none is set diff --git a/reference/7.6/Microsoft.PowerShell.Core/New-PSTransportOption.md b/reference/7.6/Microsoft.PowerShell.Core/New-PSTransportOption.md index 8385246c3fcb..2b6792d7ef42 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/New-PSTransportOption.md +++ b/reference/7.6/Microsoft.PowerShell.Core/New-PSTransportOption.md @@ -101,7 +101,7 @@ OutputBufferingMode : Block AutoRestart : false MaxShells : 40 MaxMemoryPerShellMB : 1024 -MaxIdleTimeoutms : 43200000 +MaxIdleTimeoutMs : 43200000 SDKVersion : 2 Name : ITTasks XmlRenderingType : text @@ -245,7 +245,7 @@ Accept wildcard characters: False ### -MaxIdleTimeoutSec -Limits the idle time-out set for each session to the specified value. The default value is `[Int]::MaxValue` +Limits the idle time-out set for each session to the specified value. The default value is `[int]::MaxValue` (~25 days). The idle time-out value is of significant importance when the user intends to disconnect and diff --git a/reference/7.6/Microsoft.PowerShell.Core/Receive-Job.md b/reference/7.6/Microsoft.PowerShell.Core/Receive-Job.md index ed496afacfdd..d8cf8b6de7f5 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Receive-Job.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Receive-Job.md @@ -197,7 +197,7 @@ $s = New-PSSession -ComputerName Server01, Server02, Server03 $invokeCommandSplat = @{ Session = $s ScriptBlock = { - Start-Job -Name $('MyJob-' +$env:COMPUTERNAME) -ScriptBlock { + Start-Job -Name $('MyJob-' +$Env:COMPUTERNAME) -ScriptBlock { (Get-Date).ToString() } } @@ -224,7 +224,7 @@ Id Name State HasMoreData Location Command # variable and save the results in the $results variable. The Receive-Job command must be # run in each session because the jobs were run locally on each server. $results = Invoke-Command -Session $s -ScriptBlock { - Receive-Job -Name $('MyJob-' +$env:COMPUTERNAME) + Receive-Job -Name $('MyJob-' +$Env:COMPUTERNAME) } ```