New Question
0

How to configure VLAN for a HyperV Switch through powershell command

asked 2016-03-04 11:38:13 +0300

shiva-m gravatar image

I want to configure VLAN for management OS for an external HyperV switch. From Virtual switch manager, its straight forward, by checking enable VLAN for mangement OS in HyperV switch properties.

How can I set VLAN in the same way through powershell command ?

Command I used to create HyperV Virtual switch: New-VMSwitch -Name external_switch -NetAdapterName Ethernet -AllowManagementOS $false

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2016-03-04 13:54:40 +0300

updated 2016-03-04 13:55:24 +0300

Hello,

Once you have created your switch, which in your case does not have a AllowManagementOS set to True, you cand do something like this:

Set-VMSwitch -AllowManagementOS $True switch-name

This is to enable AllowManagementOS on the switch. Then, to enable vlan you need to use the following command:

   Get-VMNetworkAdapter -SwitchName switch-name -ManagementOS | Set-VMNetworkAdapterVlan -Access -VlanId VlanID
edit flag offensive delete link more

Comments

Thanks a lot. It worked fine .!

shiva-m gravatar imageshiva-m ( 2016-03-15 17:03:06 +0300 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2016-03-04 11:38:13 +0300

Seen: 3,619 times

Last updated: Mar 04 '16