Monday, July 14, 2014

PowerShell and Hyper-V : Getting Started with Hyper-V and PowerShell


“ To live is the rarest thing in the world. Most people exist, that is all.― Oscar Wilde ”
After writing article on “Desired State Configuration”, I was thinking about topics on which I can write a similar article series.  Nothing was coming to my mind, as I already covered “Active Directory”, “Desired State configuration”, “DHCP”, “Event Viewer” and other topics.
As I use “Hyper-V” a lot, then I thought why not to write a 0 – 200 level series of articles on “Hyper-V”? to me it seems to be good idea J and I hope you may like it too.
I love "Hyper-v", before using "Hyper-V", I used to have "VMware Workstation" , but after migrating to windows 8.1 and start using "Hyper-V" I never used "VMware Workstation" again.
Let’s get started.
Prerequisites
·        Windows 8.1
·        Try to have at-least 4 GB of minimum Ram.
·        64 Bit processor

Yes, that’s all.
Step 1 :
Go to the BIOS Setting of your System / Laptop and enable Virtualisation.
photo
Step 2 :
    • Boot your System
    • Go to Control Panel
    • Click on "Programs and features"
    • Click on "Turn windows feature On of Off"
    • Select all features and sub features of "Hyper-V"
    • and Click on "OK"
    • 14-07-2014 15-09-49


Step 3 :
    • Open PowerShell Console.
    • There is no need to Import Hyper-V module , as after PowerShell v3, they all auto imported.
      Import-Module Hyper-V

    • 14-07-2014 14-38-13

    • To know the list of all cmdlets imported by Hyper-V module , you can run the simple command
      Get-Command -Module 'Hyper-V'

    • 14-07-2014 14-39-02





Step 4 :


Let's run basic cmdlets for now.




    • To get the list of "Hyper-V" hosts, run the cmdlet, Get-VMHost

    • 14-07-2014 14-40-06

    • If you want to see the list of all virtual machines, just run the cmdlet Get-VM.

    • 14-07-2014 14-40-28

    • and you can see that all of machines are Off. you can cross verify it  by open a Hyper-V management console. Smile 

    • 14-07-2014 14-40-53



That's all of now and hope to see you in next blog post.



Thanks & Regards

Aman Dhally

loki-2







Come and join my journey of : “100 Days of Self Improvement” on




If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.

No comments:

Post a Comment