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

Fixed the broken Get-VMNetworkAdapter* commands. #69

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Get-NetView.psd1
@@ -1,9 +1,9 @@
#
# Module manifest for module 'Get-NetView'
#
# Generated by: Dan Cuomo
# Generated by: Trent Helms
#
# Generated on: 2/7/2023
# Generated on: 6/9/2023
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'Get-NetView.psm1'

# Version number of this module.
ModuleVersion = '2023.2.7.226'
ModuleVersion = '2023.6.9.228'

# Supported PSEditions
CompatiblePSEditions = 'Desktop', 'Core'
Expand All @@ -21,7 +21,7 @@ CompatiblePSEditions = 'Desktop', 'Core'
GUID = '72f13048-50c0-44fd-b7f1-369e98319092'

# Author of this module
Author = 'Dan Cuomo'
Author = 'Dan Cuomo','Trent Helms'

# Company or vendor of this module
CompanyName = 'Microsoft'
Expand Down
33 changes: 19 additions & 14 deletions Get-NetView.psm1
@@ -1,4 +1,4 @@
$Global:Version = "2023.2.7.226"
$Global:Version = "2023.6.9.228"

$Script:RunspacePool = $null
$Script:ThreadList = [Collections.ArrayList]@()
Expand Down Expand Up @@ -1575,6 +1575,10 @@ function HostVNicWorker {
[parameter(Mandatory=$true)] [String] $OutDir
)

# We need to get the actual name of the VM adapter as it can be different than that of the Get-NetAdapter output
# Also, the Get-VMNetworkAdapter cmdlet is the only one that can identify the adapter by DeviceID
[String] $vmNic = (Get-VMNetworkAdapter -ManagementOS | where {$_.DeviceId -eq "$DeviceId"}).Name

$dir = $OutDir

$file = "Get-VMNetworkAdapter.txt"
Expand All @@ -1583,33 +1587,33 @@ function HostVNicWorker {
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterAcl.txt"
[String []] $cmds = "Get-VMNetworkAdapterAcl -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""}",
"Get-VMNetworkAdapterAcl -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""} | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterAcl -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""}",
"Get-VMNetworkAdapterAcl -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""} | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterExtendedAcl.txt"
[String []] $cmds = "Get-VMNetworkAdapterExtendedAcl -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""}",
"Get-VMNetworkAdapterExtendedAcl -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""} | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterExtendedAcl -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""}",
"Get-VMNetworkAdapterExtendedAcl -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""} | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterIsolation.txt"
[String []] $cmds = "Get-VMNetworkAdapterIsolation -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""}",
"Get-VMNetworkAdapterIsolation -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""} | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterIsolation -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""}",
"Get-VMNetworkAdapterIsolation -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""} | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterRoutingDomainMapping.txt"
[String []] $cmds = "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""}",
"Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""} | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""}",
"Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""} | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterTeamMapping.txt"
[String []] $cmds = "Get-VMNetworkAdapterTeamMapping -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""}",
"Get-VMNetworkAdapterTeamMapping -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""} | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterTeamMapping -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""}",
"Get-VMNetworkAdapterTeamMapping -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""} | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterVlan.txt"
[String []] $cmds = "Get-VMNetworkAdapterVlan -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""}",
"Get-VMNetworkAdapterVlan -ManagementOS | where {`$_.DeviceId -eq ""$DeviceId""} | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterVlan -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""}",
"Get-VMNetworkAdapterVlan -ManagementOS | where {`$_.ParentAdapter.Name -contains ""$vmNic""} | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds
} # HostVNicWorker()

Expand Down Expand Up @@ -1803,6 +1807,7 @@ function VMSwitchWorker {
$dir = $OutDir

$vmSwitchObject = "`$(Get-VMSwitch -Id $id)"
$vmSwitchName = (Get-VMSwitch -Id $id).Name

$file = "Get-VMSwitch.txt"
[String []] $cmds = "$vmSwitchObject",
Expand All @@ -1826,7 +1831,7 @@ function VMSwitchWorker {
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds

$file = "Get-VMNetworkAdapterTeamMapping.txt"
[String []] $cmds = "Get-VMNetworkAdapterTeamMapping -ManagementOS -SwitchName $vmSwitchObject | Format-List -Property *"
[String []] $cmds = "Get-VMNetworkAdapterTeamMapping -ManagementOS -SwitchName '$vmSwitchName' | Format-List -Property *"
ExecCommandsAsync -OutDir $dir -File $file -Commands $cmds
} # VMSwitchWorker()

Expand Down