We're using VMM 2012 and have a 5 Node cluster (running on Win 2008) of around 600 VM's.
We have around 135 VM's which were being used for a project that is winding down. We're being asked to turn these VM's off but not delete them yet. The requests to turn off all 135 VM's will be staggered over time so each week we'll need to work on this task as the requests come in.
I need to create a script whereby we can read an input (txt) file of VM names. The script will turn off the virtual machine then it will remove the network adapter from VMM for that VM.
I've been researching the commands necessary for this script but I'm hesitant to run it for fear I may impact other VM's in our cluster. I'm thinking I need to use something like the following command:
$VM = Get-SCVirtualMachine -Name "VM03"PS C:\> $Adapter = Get-SCVirtualNetworkAdapter -VM $VMPS C:\> Remove-SCVirtualNetworkAdapter -VirtualNetworkAdapter $Adapter
Is this the right command to use?
How would I use this in a script and read in a list of VM's from a txt file?