Working with PowerShell Modules

List all installed modules: PS C:>Get-Module -ListAvailable ModuleType Name                      ExportedCommands                                                           ———- —-                      —————-                                                           Manifest   ActiveDirectory           {}                                                                         Manifest   AppLocker                 {}                                                                         Manifest   BitsTransfer              {}                                                                         Manifest   FailoverClusters          {}                                                                         Manifest   GroupPolicy               {}                                                                         Manifest   NetworkLoadBalancingCl… {}                                                                         Manifest   PSDiagnostics             {Enable-PSTrace, Enable-WSManTrace, Start-Trace, Disable-PSWSManCombined… Manifest   TroubleshootingPack       {}                                                                         PS C:> List all snap-ins loaded: PS C:> get-pssnapin | ft -Auto Name                             PSVersion Description                                                                                                         —-                             ——— ———–                                                                                                         Microsoft.PowerShell.Diagnostics 2.0       This Windows PowerShell snap-in contains Windows Eventing and Performance Counter cmdlets.                          Microsoft.WSMan.Management       2.0       This Windows PowerShell snap-in contains cmdlets (such as Get-WSManInstance and Set-WSManInstance) that are used … Microsoft.PowerShell.Core        2.0       This Windows PowerShell snap-in contains cmdlets used to manage components of Windows PowerShell.                   Microsoft.PowerShell.Utility     2.0       This Windows PowerShell snap-in contains utility […]

Read more

Installing new PowerShell Snapin

You need to install new PS snapins as admin user using PoweShell.exe: PS C:> powershell “C:DownloadsSoftwarePowerShellWASPWASPInstall.ps1” -Force You’re running PowerShell 2.0, so you don’t need to Install this as a PSSnapin, you can use Import-Module (or Add-Module in CTP2) to load it.  If you still want to install it as a PSSnapin, re-run this script with -Force Microsoft (R) .NET Framework Installation utility Version 2.0.50727.4927 Copyright (c) Microsoft Corporation.  All rights reserved. Running a transacted installation. Beginning the Install phase of the installation. See the contents of the log file for the C:DownloadsSoftwarePowerShellWASPWASPWASP.dll assembly’s progress. The file is located at […]

Read more

Setting up environment for PowerShell scripting

The first step that every PS scripter should do is to set ExecutionPolicy appropriately.  If you work at the developer level, where you have to run various scripts/code from other sources and can validated the script actions only then setup it to Unrestricted. Otherwise RemoteSigned is the recommended value.   Setting up PS ExecutionPolicy to to Unrestricted: You need to run this cmdlet as admin user: PS C:> Set-ExecutionPolicy Unrestricted PS C:> Get-ExecutionPolicy Unrestricted PS C:> Otherwise PS will err at you as shown below: PS C:> Set-ExecutionPolicy Unrestricted   Execution Policy Change The execution policy helps protect you from […]

Read more