diff --git a/reference/6/Microsoft.PowerShell.Core/Get-Module.md b/reference/6/Microsoft.PowerShell.Core/Get-Module.md index 71a91ac2cc7c..828183bd7515 100644 --- a/reference/6/Microsoft.PowerShell.Core/Get-Module.md +++ b/reference/6/Microsoft.PowerShell.Core/Get-Module.md @@ -111,13 +111,14 @@ This command gets all of the exported files for all available modules. ### Example 4: Get a module by its fully qualified name ```powershell -PS> Get-Module -FullyQualifiedName @{ModuleName="Microsoft.PowerShell.Management";ModuleVersion="3.1.0.0"} | Format-Table -Property Name,Version +PS> $FullyQualifedName = @{ModuleName="Microsoft.PowerShell.Management";ModuleVersion="3.1.0.0"} +PS> Get-Module -FullyQualifiedName | Format-Table -Property Name,Version ``` ```output -Name Version ----- ------- -Microsoft.PowerShell.Management 3.1.0.0 +Name Version +---- ------- +Microsoft.PowerShell.Management 3.1.0.0 ``` This command gets the **Microsoft.PowerShell.Management** module by specifying the fully qualified name of the module by using the **FullyQualifiedName** parameter. @@ -222,37 +223,39 @@ This lets you see the module files that each script is exporting. ### Example 7: Display the contents of a module manifest -```powershell -The first command gets the PSModuleInfo object that represents BitsTransfer module. It saves the object in the $m variable. +These commands display the contents of the module manifest for the Windows PowerShell **BitsTransfer** module. -PS> $m = Get-Module -list -Name BitsTransfer +Modules are not required to have manifest files. +When they do have a manifest file, the manifest file is required only to include a version number. +However, manifest files often provide useful information about a module, its requirements, and its contents. -The second command uses the Get-Content cmdlet to get the content of the manifest file in the specified path. It uses dot notation to get the path to the manifest file, which is stored in the Path property of the object. The output shows the contents of the module manifest. +```powershell +# First command +PS> $m = Get-Module -list -Name BitsTransfer +# Second command PS> Get-Content $m.Path ``` ```output -@{ -GUID="{8FA5064B-8479-4c5c-86EA-0D311FE48875}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="1.0.0.0" -Description="Windows Powershell File Transfer Module" -PowerShellVersion="2.0" -CLRVersion="2.0" -NestedModules="Microsoft.BackgroundIntelligentTransfer.Management" -FormatsToProcess="FileTransfer.Format.ps1xml" -RequiredAssemblies=Join-Path $psScriptRoot "Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll" +@ { + GUID = "{8FA5064B-8479-4c5c-86EA-0D311FE48875}" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = "1.0.0.0" + Description = "Windows Powershell File Transfer Module" + PowerShellVersion = "2.0" + CLRVersion = "2.0" + NestedModules = "Microsoft.BackgroundIntelligentTransfer.Management" + FormatsToProcess = "FileTransfer.Format.ps1xml" + RequiredAssemblies = Join-Path $psScriptRoot "Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll" } ``` -These commands display the contents of the module manifest for the Windows PowerShell **BitsTransfer** module. +The first command gets the PSModuleInfo object that represents BitsTransfer module. It saves the object in the `$m` variable. -Modules are not required to have manifest files. -When they do have a manifest file, the manifest file is required only to include a version number. -However, manifest files often provide useful information about a module, its requirements, and its contents. +The second command uses the `Get-Content` cmdlet to get the content of the manifest file in the specified path. It uses dot notation to get the path to the manifest file, which is stored in the Path property of the object. The output shows the contents of the module manifest. ### Example 8: List files in module directory @@ -296,25 +299,24 @@ For more information, see [`Import-Module`](Import-Module.md) and [`Import-PSSes ### Example 10: Manage a computer that does not run the Windows operating system -```powershell -The first command uses the New-CimSession cmdlet to create a session on the RSDGF03 remote computer. The session connects to WMI on the remote computer. The command saves the CIM session in the $cs variable. +The commands in this example enable you to manage the storage systems of a remote computer that is not running the Windows operating system. +In this example, because the administrator of the computer has installed the Module Discovery WMI provider, the CIM commands can use the default values, which are designed for the provider. +```powershell +# First command PS> $cs = New-CimSession -ComputerName RSDGF03 -The second command uses the CIM session in the $cs variable to run a Get-Module command on the RSDGF03 computer. The command uses the Name parameter to specify the Storage module. The command uses a pipeline operator (|) to send the Storage module to the Import-Module cmdlet, which imports it into the local session. - +# Second command PS> Get-Module -CimSession $cs -Name Storage | Import-Module -The third command runs the Get-Command cmdlet on the Get-Disk command in the Storage module. When you import a CIM module into the local session, Windows PowerShell converts the CDXML files that represent the CIM module into Windows PowerShell scripts, which appear as functions in the local session. - +# Third command PS> Get-Command Get-Disk CommandType Name ModuleName ----------- ---- ---------- Function Get-Disk Storage -The fourth command runs the Get-Disk command. Although the command is typed in the local session, it runs implicitly on the remote computer from which it was imported. The command gets objects from the remote computer and returns them to the local session. - +# Fourth command PS> Get-Disk Number Friendly Name OperationalStatus Total Size Partition Style @@ -322,8 +324,13 @@ Number Friendly Name OperationalStatus Total Size Partitio 0 Virtual HD ATA Device Online 40 GB MBR ``` -The commands in this example enable you to manage the storage systems of a remote computer that is not running the Windows operating system. -In this example, because the administrator of the computer has installed the Module Discovery WMI provider, the CIM commands can use the default values, which are designed for the provider. +The first command uses the `New-CimSession` cmdlet to create a session on the RSDGF03 remote computer. The session connects to WMI on the remote computer. The command saves the CIM session in the `$cs` variable. + +The second command uses the CIM session in the `$cs` variable to run a `Get-Module` command on the RSDGF03 computer. The command uses the Name parameter to specify the Storage module. The command uses a pipeline operator (|) to send the Storage module to the `Import-Module` cmdlet, which imports it into the local session. + +The third command runs the `Get-Command` cmdlet on the `Get-Disk` command in the Storage module. When you import a CIM module into the local session, Windows PowerShell converts the CDXML files that represent the CIM module into Windows PowerShell scripts, which appear as functions in the local session. + +The fourth command runs the `Get-Disk` command. Although the command is typed in the local session, it runs implicitly on the remote computer from which it was imported. The command gets objects from the remote computer and returns them to the local session. ## PARAMETERS @@ -613,4 +620,4 @@ When you create a CIM session on the local computer, Windows PowerShell uses DCO [New-PSSession](New-PSSession.md) -[Remove-Module](Remove-Module.md) \ No newline at end of file +[Remove-Module](Remove-Module.md)