Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ OutputBufferingMode : Block
AutoRestart : false
MaxShells : 300
MaxMemoryPerShellMB : 1024
MaxIdleTimeoutms : 43200000
MaxIdleTimeoutMs : 43200000
SDKVersion : 1
Name : Full
XmlRenderingType : text
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions reference/5.1/Microsoft.PowerShell.Core/Import-Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Import-Module [-Global] [-Prefix <String>] [-Function <String[]>] [-Cmdlet <Stri
The `Import-Module` cmdlet adds one or more modules to the current session. Starting in PowerShell
3.0, installed modules are automatically imported to the session when you use any commands or
providers in the module. However, you can still use the `Import-Module` command to import a module.
You can disable automatic module importing using the `$PSModuleAutoloadingPreference` preference
variable. For more information about the `$PSModuleAutoloadingPreference` variable, see
You can disable automatic module importing using the `$PSModuleAutoLoadingPreference` preference
variable. For more information about the `$PSModuleAutoLoadingPreference` variable, see
[about_Preference_Variables](About/about_Preference_Variables.md).

A module is a package that contains members that can be used in PowerShell. Members include
Expand All @@ -116,7 +116,7 @@ Starting in Windows PowerShell 3.0, you can use `Import-Module` to import Common
you use cmdlets that are implemented in non-managed code assemblies, such as those written in C++.

For remote computers that don't have PowerShell remoting enabled, including computers that aren't
running the Windows operating system, you can use the **CIMSession** parameter of `Import-Module`
running the Windows operating system, you can use the **CimSession** parameter of `Import-Module`
to import CIM modules from the remote computer. The imported commands run implicitly on the remote
computer. A **CIMSession** is a connection to Windows Management Instrumentation (WMI) on the
remote computer.
Expand All @@ -133,7 +133,7 @@ Import-Module -Name PSDiagnostics

### Example 2: Import all modules specified by the module path

This example imports all available modules in the path specified by the `$env:PSModulePath`
This example imports all available modules in the path specified by the `$Env:PSModulePath`
environment variable into the current session.

```powershell
Expand Down Expand Up @@ -162,7 +162,7 @@ session.
This example uses an explicit path to identify the module to import.

```powershell
Import-Module -Name c:\ps-test\modules\test -Verbose
Import-Module -Name C:\ps-test\modules\test -Verbose
```

```Output
Expand Down Expand Up @@ -434,7 +434,7 @@ PS> 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
42 changes: 21 additions & 21 deletions reference/5.1/Microsoft.PowerShell.Core/Invoke-Command.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
```

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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).

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
}
```

Expand All @@ -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'
}
Expand All @@ -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
Expand Down Expand Up @@ -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 `<Remote-Computer-Name>`
in WS-Management, use the following command in the `WSMan` provider, where `<Remote-Computer-Name>`
is the name of the remote computer:

`Set-Item -Path WSMan:\Localhost\Client\TrustedHosts -Value \<Remote-Computer-Name\>`
Expand Down
16 changes: 8 additions & 8 deletions reference/5.1/Microsoft.PowerShell.Core/New-Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```

Expand Down Expand Up @@ -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
```

Expand All @@ -173,7 +173,7 @@ NestedModules : {}
```

```powershell
Get-Command hello
Get-Command Hello
```

```Output
Expand All @@ -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
Expand All @@ -217,15 +217,15 @@ Hello ScriptMethod System.Object Hello();
```

```powershell
$m.goodbye("Jane")
$m.Goodbye("Jane")
```

```Output
Goodbye, Jane
```

```powershell
$m.hello("Manoj")
$m.Hello("Manoj")
```

```Output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ New-PSRoleCapabilityFile [-Path] <String> [-Guid <Guid>] [-Author <String>] [-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
Expand Down Expand Up @@ -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[]
Expand Down
8 changes: 4 additions & 4 deletions reference/5.1/Microsoft.PowerShell.Core/New-PSSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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).
Expand Down
Loading