Showing posts with label virtual switch. Show all posts
Showing posts with label virtual switch. Show all posts

Thursday, August 21, 2014

Part - 8 : PowerShell and Hyper-V : Mounting ISOs to the Hyper-V Virtual Machine's DVD Drives

 

Yesterday, we have seen that how can we add a virtual disk to the Hyper-V virtual machine.

When I was writing that blog, I was also thinking about to write a article on that how can we add a ISO file to the DVD drive of the Virtual machine.

It's cool to know if you able to directly mount as ISO file to the virtual machine by using our lovely blue coloured PowerShell console.

You want to know how to do that? YES ? Great. let's started.

In the Below screenshot you can see that, currently there is no "CD / DVD Disk" mounted on the DVD Drive of my Virtual Machine "Windows 2008 R2".

1

I am hoping that by now, you already know how to get the list of all virtual machines.,

We can use the "Get-VM" cmdlet for that, and you can see that "Windows 2008 R2" virtual machine is up and running.

2

In the below screen shot, you can see a list of my all ISO files located in F:\ISO_Image folder.

I am choosing the "Windows2008R2_all_edition.ISO" file to mount to the my "Windows 2008 R2" virtual machine's DVD Drive.

4

We use the Set-VMDvdDrive cmdlet to mount the ISO file to the DVD drive of the virtual machines.

Set-VMDvdDrive -VMName 'Windows 2008 R2' -Path 
"F:\ISO_Image\Win2008R2_all_editions.iso"
In the above command, we are using  Set-VMDvdDrivecmdlet , -VMName  parameter we are providing the name of the virtual machine on which we want to mount the ISO file, and in -Path parameters we are providing the path of the ISO file which we want to mount.
In the below screenshot, you can see that command has been completed successfully.

3


and if you check the virtual machine, you can see that our ISO is mounted successfully.


5


Come-on.. Believe me Winking smile 


6


That's all for today. See you in my next blog post. Keep Smiling.


tumblr_mfxux9bqN61qzmvsio6_250

Thanks.

Aman Dhally

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”.

Tuesday, July 22, 2014

Part - 2 : PowerShell and Hyper-V : Managing Hyper-V Virtual Switch


1. Part 1 :  PowerShell and Hyper-V : Getting Started
"Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.- Dr. Seuss"
In my previous post, we have seen the basic of "PowerShell and Hyper-V". That shows how to install Hyper-V and how to get the list of all virtual machines (those were pre-created).
Today, we are going create a new virtual switch.
What is a virtual switch?
In a simple language, it is virtual switch is virtual like virtual machines. Our Virtual machines need to connect with either each other, or with our physical machines, By using virtual switch, we can create a LAN environment.  We can created multiple LAN environment using these Virtual switches.
There are 3 types of virtual switches.
  1. External
  2. Internal
  3. Private
External :
In external switch, our virtual machine is able to talk with all of resources available on our physical network.
Internal :
Using internal switch, our virtual machine is only able to talk with the host and other virtual machines.
Private:
Private switch allow communication between the virtual machines on the host that's all.
Let's get started.
I am going to create a new External virtual switch.
Hyper-V external virtual switches are  bind on the physical lan/wifi adapter by which they can connected to physical environment.
To get the list of all network adapters we can use  Get-NetAdapter cmdlet.

22-07-2014 15-45-20
22-07-2014 15-44-39
 I am connected to my physical network using my LAN card named as "Ethernet". I will bind "Virtual External Switch" on "Ethernet" lan.
To create a new virtual switch we use New-VMSwitch cmdlet.
To list all of your Virtual switches, use the cmdlet,Get-VMSwitch
You can see that, currently, there is no virtual switch which is connected to External network.,
22-07-2014 15-49-26
22-07-2014 15-47-37






Creating external switch is simple. We just need to name of the External virtual swtich, and then name of our LAN/WiFI adapter name and that's all.
The command is : 
New-VMSwitch -Name "Connect_toThe_World" -NetAdapterName 'Ethernet' -AllowManagementOS $true

22-07-2014 15-48-12

And you can see that , new External Switch is created.

22-07-2014 17-41-38

If you want to create an internal or private switch, you mainly need two parameters with New-VMSwitch cmdlet, -Name and -SwitchType

Creating Internal virtual switch.
 New-VMSwitch -Name "my_lonely_world" -SwitchType Internal
22-07-2014 18-24-21

Creating Private virtual switch.

New-VMSwitch -Name "I_M_Secret" -SwitchType Private

22-07-2014 18-27-01

and you can see the list of all virtual switches.

22-07-2014 18-27-59

That's all for now Smile See you in my next blog posts.



searching-tumblr

Thanks.

Aman Dhally



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”.