Created
May 17, 2020 16:54
-
-
Save aaronjwood/7881f9c9af2237ba306b1cf03ed13159 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
$dev = (Get-PnpDevice -PresentOnly).Where{ $_.InstanceId -like $instanceId } | |
$vm = Get-VM $vmName | |
$locationPath = (Get-PnpDeviceProperty -KeyName DEVPKEY_Device_LocationPaths -InstanceId $dev.InstanceId).Data[0] | |
Disable-PnpDevice -InstanceId $dev.InstanceId -Confirm:$false | |
Dismount-VMHostAssignableDevice -LocationPath $locationPath -Force -Verbose | |
Add-VMAssignableDevice -VM $vm -LocationPath $locationPath -Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment