Created
September 15, 2016 15:03
-
-
Save jtuttas/17add34e53a84cec2ab5676456e930b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Import-Module "C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\bin\psModules\virtualmachinemanager\virtualmachinemanager" | |
| #Get-SCVMMServer -ComputerName 'mmbbs-vmm1' -UserRoleName 'Administrator' | |
| $VLAN_ID = Read-Host 'Bitte VLAN ID z.B. 32 eingeben' | |
| $SERVICE_Name = Read-Host 'Bitte VM name eingeben (* als Platzhalter)' | |
| $vms= Get-SCVirtualMachine | Where-Object {$_.Name -like $SERVICE_Name} | |
| $vms | foreach { | |
| $netName = "Student Networks " + $VLAN_ID.ToString() | |
| $VMNetwork = Get-SCVMNetwork -Name $netName | |
| $VMSubnet = Get-SCVMSubnet -Name ($netName + '_0') | |
| $VMNetwork | ft | |
| $VMSubnet | ft | |
| $networkAdapter = Get-SCVirtualNetworkAdapter -VM $_ | |
| Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $networkAdapter -VMNetwork $VMNetwork -VMSubnet $VMSubnet -VLanEnabled $true -VLanID $VLAN_ID -VirtualNetwork "Student Network Switch" -IPv4AddressType Dynamic -IPv6AddressType Dynamic -NoPortClassification | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment