The Altaro PowerShell Hyper-V Cookbook (Free)

Ok this is probably not a latest new but Altaro has release HYPER-V e-book with lots and lots of PowerShell commands. I found out this is really useful if you’re playing around or managing HYPER-V environments. Kudos to the author –Jeffery Hicks (PowerShell MVP)

You can download the free e-book from here and also don’t forget to download the sample PS commands freely available to download along with that e-book. You can get them from here. Also pay a visit to authors blog and you’ll find more latest updates and new PS commands Smile

If you’re new to the PowerShell world then you need to step into few places first to brush your knowledge. Believe me PowerShell is most important in your future career so spend some on it. You can start from here & here

Advertisements

How to Remove SCOM 2012 Management Packs Through PowerShell

While I’m working on my SCOM LAB environment I came across the requirement of removing the Active Directory Management Pack I’ve install into the system. One of the painful process is removing them one by one from the console, top of that I found out I’ve imported the MP’s related to other languages as well Sad smile

There has to be an easy way for this right? You guess correct thanks to tight PowerShell integration with SCOM Microsoft has provided a solution for that. With below mention command you can remove the management pack related to any software application. We only provide a keyword and base on that PowerShell will do the MP library search and remove the relevant MP’s.

image

In the above command you can replace the “AD” with any keyword. More information can be found on below mention TechNet article,

http://technet.microsoft.com/en-us/library/hh545200.aspx

Using Windows PowerShell to change the VM-Switch assigned to Virtual Machine’s (Windows 2012, Windows 8)

Recently I’ve been trying to do some lab setup for a demonstration. One of the constant changes I do is creating and deleting VM’s in my laptop and creating various Network switches for VM’s. Now assigning a VM-Switch to a virtual machine can be easy task by using GUI but it can be painful it you’ve to go through each VM’s settings page and selecting the correct VM-Switch. You’ll get the idea if you’ve been managing more than 10-15 VM’s in your lab setup like I do Smile

image

(My HYPER-V console in the laptop)

image

(VM-Switch I’ve created for various labs)

 

Now using PowerShell we can assign VM-Switch to selected number of VM’s in one parameter or to entire VM’s in my laptop in one go. Now this reminds me the famous quote in Spiderman movie “Great power comes with great responsibilities” Smile Anyway we’ll use the power carefully in the PowerShell.

Now assuming I want to change only selected VM’s VM-Switch to “PrivateNetwork” I can run the PS command as follows,

Connect-VMNetworkAdapter -VMName Demo-WIN2008R2-DC,Demo-WIN2008R2-SRV1,DEMO-WIN2008R2-SRV2 –Switch PrivateNetwork

image

Assuming I want to change all VM’s VM-Switch name to “VMSW01” all I have to do is type the following command,

Connect-VMNetworkAdapter –VMName * –SwitchName VMSW01 

Note: I found out in your VM-Switch naming convention if you keep spaces and use that VMM-Switch name in PowerShell it won’t work. This is something I yet to find out.

PowerShell module for hyper-v

PowerShell is a very powerful tool you can use across Microsoft technologies. Microsoft will keep on adopting and improving this technology every time. Right now PowerShell module ver 2 for HYPER-V has been released. This article will discuss how can you install the modules correctly into your Windows 2008 R2 server. Please note this is for Windows 2008 R2 only!

First get the PS modules from the codeplex web site. Url is here

image

Download the zip file to a root drive or any preferred area and unzip. Once that complete locate the “install.bat” file and execute it with administrator privilege.

image

[install hyper-v module13[4].png]

[install hyper-v module15[4].png]

Once the installation completed, we’ll move the unzip folder in the PS module folder located in the root drive, (I’ve rename the folder as HyperV and copied to the modules folder)

image

Now we can import this to the system by executing through PowerShell. Open the PowerShell and try to run “import-module HyperV” you’ll grant with a error messageSmile

image

We need to enable the execution permissions to import the module, please follow the instruction mention in below screenshot,

image

After that import the Hyper-V modules,

image

Now when that complete we can run the command “Get-Command –Module hyperv” to list down the available commands,

image

Now we have plethora of task can be automated combing these commands, it’s all about your imagination Smile

image

Overcome phobia for PowerShell

Microsoft introduced PowerShell with Windows 2008 as a central method to manage the Windows platform. If you look at the history of PowerShell it has been around in various method (Eg: Scripts, WMI…etc) Actually PowerShell has been there with the introduction with Exchange 2007. But most of the administrators stayed away from the CLI and wanted to stick with GUI. In the Linux world this is one humor factor for the Windows Administrators. If you loose the GUI you can’t do anything despite with limited commands available in the dos.

In Microsoft roadmap PowerShell is a key technology. They wanted to have it as a central de facto for managing Windows software. So if you’re a system administrator who is overlooking Windows servers you better ready for this. So what makes system administrators skip away from PowerShell? The main answer is it is CLI! and they hate for typing lengthy commands plus they need to have the script knowledge. Most of the surveys carried out by MS and third party reviewers proved this.

Microsoft has been taking every step to overcome but as a fundamental rule “Changes are not accepted happily” Microsoft is trying to improve the PowerShell by introducing GUI to that in certain level. But today my attention goes to totally different third party software called ‘”PowerGUI” offered by Quest software.

Quest company is Microsoft Gold Certified ISV partner providing solutions for MS software. They have introduced PowerGUI as a free software along with various PowerShell command packs develop by their staff members and forum users.

To be honest I’m also little bit reluctant to PowerShell but with this software it makes us really easy to embrace the new technology with less hassle. As a new user to PowerShell and PowerGUI software you will find lot of resources to get up and running. The interface is very simple to understand. As long as you know AD, Exchange console this software will be not that difficult to understand. One cool feature I found out is filtering has been carried out to extend level. In my customer visit I get lot of inquires about how to get report like this, that filter in various methods, well answer is PowerGUI.

Apart from that you’ll also find a PowerShell Editor as well. One nifty feature is whatever the command you tried to create using GUI in the background you’ll find the relevant PowerShell command. So you can cut and paste it and then do slice and dice and adjust it, optimize it and experiment it.

1

2

Apart from that creating your own PowerShell commands will be a breeze with the embedded technologies.  So my two cents recommendation is go for it, use it, taste it and be ready for the future Smile