DDA Audit - Determine what devices are connected to what VM's

Ashley Walker 21 Reputation points
2021-02-05T06:51:12.62+00:00

Pretty straight forward but I cannot find the appropriate PowerShell Command to do this.

How do I determine what devices have been assigned to the VM via Discrete Device Assignment (DDA)?

For example, I may have 10 GPU's and I know exactly where 3 of them area, and the PCIROOT address of those 3. But I have 7 more (I have the PCIROOT of the other 7 as well) that I am not sure which VM's they are attached to (mixture of Linux and windows machines). Is there a simple command where I can give the VM name, and I get back a collection of devices that are attached to the VM?

For any that are not attached to a VM I can use the following snippet:

$pnpdevs = Get-PnpDevice -presentOnly
$gpudevs = $pnpdevs | where-object {$.Class -like "Display" -and $.Manufacturer -like "NVIDIA"}

Hyper-V
Hyper-V
A Windows technology providing a hypervisor-based virtualization solution enabling customers to consolidate workloads onto a single server.
2,636 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 34,271 Reputation points Microsoft Vendor
    2021-02-05T08:49:43.847+00:00

    What about Get-VMAssignableDevice?

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ashley Walker 21 Reputation points
    2021-02-06T01:15:14.57+00:00

    That worked perfectly! Thank you :)

    0 comments No comments