Share via


PowerShellGUI Tools - Disk,Memory and Process - Modules

I've created a script which gives details of Disk, Memory and Process and its represented graphically. 

Here, the scripts are enclosed in module. At its simplest, a module is just a PowerShell script, contained in a file with a .PSM1 extension

A module is some chunk of code that you can import into PowerShell. Once imported, any cmdlets, scripts, or providers can be accessed.

Installation of a module is now very simple. download and save the file c:\PowerShellGUI.psm1

This PowerShellGUI module consists of

  1. Get-DiskSpaceGUI
  2. Get-MemoryGUI
  3. Get-ProcessGUI

Now we just need to import our module. The Scope is limited to session. If you want to load automatically then you need to create Profile (http://technet.microsoft.com/en-us/library/ff461033.aspx)

You can save the file in a default module path that can be identified using environmental variable.

PS:\$ENV:PSMODULEPATH

There are many ways to load a module. The preferred way is to create folder and save the Module in that folder

To import and loading a module as follows.

  1. Download the module code 

  2. Create a folder PowerShellGUI (Same name as that of a Module name) file at any of the below location %windir%\System32\WindowsPowerShell\v1.0\Modules OR %UserProfile%\Documents\WindowsPowerShell\Modules (preferred) 

  3. Save the PowerShellGUI.psm1 %UserProfile%\Documents\WindowsPowerShell\Modules\PowerShellGUI\ (preferred)

  4. Import-Module PowershellGUI

  5. This will import the module and functions into powershell

    • Get-Module  -ListAvailable

     This will list down all available modules in powershell

    • Get-Command -Module PowerShellGUI
  6. Once you are done with step 1, 2 and 3 open a powershell window and run below commands.

  7. PS:\Import-Module -Name PowershellGUI

  8.  This will import the module and functions into powershell

  9. PS:\Get-Module  -ListAvailable

  10.  This will list down all available modules in powershell

  11. Get-Command -Module PowerShellGUI

OR

Save the module  to C:\PowershellGUI.psm1

  1. PS:\ Import-Module -Name C:\PowerShellGUI.psm1
  2.  PS:\Get-Module PowerShellGUI

PS:\Get-Command -Module PowershellGUI

Ouptut:-

Remove Module:-

PS:\ Remove-Module -Name PowershellGUI

Download the PowerShellGUI.psm1 from the below link

Reference:

The code is tested in all version of Powershell 2.0 onwards. You need to have .Net framework 3.0 or 3.5 as its pre-requisites for 3D Graph Display.

See Also