Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SurveyDDA.ps1 fix for Powershell 6.0 and later #1986

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hyperv-tools/DiscreteDeviceAssignment/SurveyDDA.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ foreach ($pcidev in $pcidevs) {
# aren't assignable.
#
$doubleslashDevId = "*" + $pcidev.PNPDeviceID.Replace("\","\\") + "*"
$irqAssignments = gwmi -query "select * from Win32_PnPAllocatedResource" | Where-Object {$_.__RELPATH -like "*Win32_IRQResource*"} | Where-Object {$_.Dependent -like $doubleslashDevId}
$irqAssignments = Get-WmiObject -query "select * from Win32_PnPAllocatedResource" | Where-Object {$_.__RELPATH -like "*Win32_IRQResource*"} | Where-Object {$_.Dependent -like $doubleslashDevId}

#$irqAssignments | Format-Table -Property __RELPATH

Expand Down Expand Up @@ -130,13 +130,13 @@ foreach ($pcidev in $pcidevs) {
# not strictly an issue devices, but very useful when you want to set MMIO gap sizes
#

$mmioAssignments = gwmi -query "select * from Win32_PnPAllocatedResource" | Where-Object {$_.__RELPATH -like "*Win32_DeviceMemoryAddress*"} | Where-Object {$_.Dependent -like $doubleslashDevId}
$mmioAssignments = Get-WmiObject -query "select * from Win32_PnPAllocatedResource" | Where-Object {$_.__RELPATH -like "*Win32_DeviceMemoryAddress*"} | Where-Object {$_.Dependent -like $doubleslashDevId}
$mmioTotal = 0
foreach ($mem in $mmioAssignments)
{
$baseAdd =$mem.Antecedent.SubString($mem.Antecedent.IndexOf("""")+1)
$baseAdd=$baseAdd.SubString(0,$baseAdd.IndexOf(""""))
$mmioRange = gwmi -query "select * from Win32_DeviceMemoryAddress" | Where-Object{$_.StartingAddress -like $baseAdd}
$mmioRange = Get-WmiObject -query "select * from Win32_DeviceMemoryAddress" | Where-Object{$_.StartingAddress -like $baseAdd}
$mmioTotal = $mmioTotal + $mmioRange.EndingAddress - $mmioRange.StartingAddress
}
if ($mmioTotal -eq 0)
Expand Down