From a1b6f41d5672e990e4c76728785bb4d46a1c2e19 Mon Sep 17 00:00:00 2001 From: Peter Vandivier Date: Thu, 12 Jul 2018 14:49:38 +0100 Subject: [PATCH 1/4] Update Get-Module.md move commentary outside code-blocks to reduce horizontal scrolling --- .../6/Microsoft.PowerShell.Core/Get-Module.md | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/reference/6/Microsoft.PowerShell.Core/Get-Module.md b/reference/6/Microsoft.PowerShell.Core/Get-Module.md index 71a91ac2cc7c..9c6b3ec775f9 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,13 +223,13 @@ 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. - +```powershell PS> $m = Get-Module -list -Name BitsTransfer +``` 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 PS> Get-Content $m.Path ``` @@ -296,25 +297,26 @@ 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. - +```powershell 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. - +```powershell 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. - +```powershell 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. - +```powershell PS> Get-Disk Number Friendly Name OperationalStatus Total Size Partition Style @@ -613,4 +615,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) From 4d865f6dbf45af5c21fa11d6f351895917d0eb1a Mon Sep 17 00:00:00 2001 From: David Coulter Date: Thu, 12 Jul 2018 08:01:18 -0700 Subject: [PATCH 2/4] Update Get-Module.md Added spacing around codefence block to clear build issue. --- reference/6/Microsoft.PowerShell.Core/Get-Module.md | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/6/Microsoft.PowerShell.Core/Get-Module.md b/reference/6/Microsoft.PowerShell.Core/Get-Module.md index 9c6b3ec775f9..bad068170ffd 100644 --- a/reference/6/Microsoft.PowerShell.Core/Get-Module.md +++ b/reference/6/Microsoft.PowerShell.Core/Get-Module.md @@ -224,6 +224,7 @@ This lets you see the module files that each script is exporting. ### Example 7: Display the contents of a module manifest The first command gets the PSModuleInfo object that represents BitsTransfer module. It saves the object in the $m variable. + ```powershell PS> $m = Get-Module -list -Name BitsTransfer ``` From 83f09ec0df80dfac8da9fe029d815ad1ab4ef76d Mon Sep 17 00:00:00 2001 From: Peter Vandivier Date: Thu, 12 Jul 2018 16:59:00 +0100 Subject: [PATCH 3/4] single code-block per example section hopefully w/in guidelines & still improves readability. also took the opportunity to vertical-align the manifest example --- .../6/Microsoft.PowerShell.Core/Get-Module.md | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/reference/6/Microsoft.PowerShell.Core/Get-Module.md b/reference/6/Microsoft.PowerShell.Core/Get-Module.md index bad068170ffd..e9eb41ba8040 100644 --- a/reference/6/Microsoft.PowerShell.Core/Get-Module.md +++ b/reference/6/Microsoft.PowerShell.Core/Get-Module.md @@ -223,30 +223,31 @@ This lets you see the module files that each script is exporting. ### Example 7: Display the contents of a module manifest -The first command gets the PSModuleInfo object that represents BitsTransfer module. It saves the object in the $m variable. +The first command gets the PSModuleInfo object that represents BitsTransfer module. It saves the object in the `$m` variable. + +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 -``` -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 +# 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" } ``` @@ -298,26 +299,29 @@ 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 -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 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. + ```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. -```powershell + +# 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. -```powershell +# 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. -```powershell +# Fourth command PS> Get-Disk Number Friendly Name OperationalStatus Total Size Partition Style From fd0a4dd8fa82d0d26d5b6b5086eec34c1004faa5 Mon Sep 17 00:00:00 2001 From: David Coulter Date: Mon, 16 Jul 2018 08:45:29 -0700 Subject: [PATCH 4/4] Update Get-Module.md Re-organizing content to be Intro, Example(s), Explanation. --- .../6/Microsoft.PowerShell.Core/Get-Module.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/reference/6/Microsoft.PowerShell.Core/Get-Module.md b/reference/6/Microsoft.PowerShell.Core/Get-Module.md index e9eb41ba8040..828183bd7515 100644 --- a/reference/6/Microsoft.PowerShell.Core/Get-Module.md +++ b/reference/6/Microsoft.PowerShell.Core/Get-Module.md @@ -223,9 +223,11 @@ This lets you see the module files that each script is exporting. ### Example 7: Display the contents of a module manifest -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. -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. +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. ```powershell # First command @@ -251,11 +253,9 @@ PS> Get-Content $m.Path } ``` -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 @@ -299,13 +299,8 @@ 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 -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. +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 @@ -329,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