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
- Get-DiskSpaceGUI
- Get-MemoryGUI
- 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.
Download the module code
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)
Save the PowerShellGUI.psm1 %UserProfile%\Documents\WindowsPowerShell\Modules\PowerShellGUI\ (preferred)
Import-Module PowershellGUI
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
Once you are done with step 1, 2 and 3 open a powershell window and run below commands.
PS:\Import-Module -Name PowershellGUI
This will import the module and functions into powershell
PS:\Get-Module -ListAvailable
This will list down all available modules in powershell
Get-Command -Module PowerShellGUI
OR
Save the module to C:\PowershellGUI.psm1
- PS:\ Import-Module -Name C:\PowerShellGUI.psm1
- 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:
- http://gallery.technet.microsoft.com/PowerShell-Disk-Space-cf5568f4
- http://gallery.technet.microsoft.com/PowerShell-Memory-Details-b881196b
- http://gallery.technet.microsoft.com/Top-10-Process-Listing-d638b0f1
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
- What's new in PowerShell
- PowerShell Portal
- Wiki: Portal of TechNet Wiki Portals
- Active Directory Users attributes-Powershell