Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norman-bauer/601596414eb0e6e91c297c3a0f7c68d6 to your computer and use it in GitHub Desktop.
Save norman-bauer/601596414eb0e6e91c297c3a0f7c68d6 to your computer and use it in GitHub Desktop.
This small snippet removes mounted media from all SCVMM VMs.
Get-SCVirtualMachine | Foreach-Object {
$vm = $_;
$dvd = Get-SCVirtualDVDDrive -VM $vm;
if ($dvd.Connection -ne 'None' -and $dvd.Connection -ne $null) {
Set-SCVirtualDVDDrive -VirtualDVDDrive $dvd -NoMedia
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment