Skip to content

Commit e21eec9

Browse files
authored
Change the order in which VMNetworkAdapter info is collected (#405)
# Description This pull request includes changes to the `Get-CommonConfigState` and `Get-ServerConfigState` functions in the `SdnDiag.Common.psm1` and `SdnDiag.Server.psm1` files, respectively. The modifications aim to enhance the data collection process for network adapter and Hyper-V network details. Changes in `Get-CommonConfigState`: * Added commands to export VPort and VMQ Queue details. Changes in `Get-ServerConfigState`: * Reorganized and updated the gathering of Hyper-V network configuration details, including the reintroduction of commands to export VMNetworkAdapter and related details in a more efficient format. [[1]](diffhunk://#diff-11217f20b55d3b4ea34c8c217794c81d65acc4852dff9bf4295e5cc4d6dfaeedL670-R674) [[2]](diffhunk://#diff-11217f20b55d3b4ea34c8c217794c81d65acc4852dff9bf4295e5cc4d6dfaeedR704-R715) # Change type - [x] Bug fix (non-breaking change) - [ ] Code style update (formatting, local variables) - [ ] New Feature (non-breaking change that adds new functionality without impacting existing) - [ ] Breaking change (fix or feature that may cause functionality impact) - [ ] Other # Checklist: - [x] My code follows the style and contribution guidelines of this project. - [x] I have tested and validated my code changes.
1 parent 8910552 commit e21eec9

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/modules/SdnDiag.Common.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ function Get-CommonConfigState {
535535
Get-NetAdapterBinding | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
536536
Get-NetAdapterChecksumOffload | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
537537
Get-NetAdapterStatistics | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
538+
Get-NetAdapterVPort | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
539+
Get-NetAdapterVmqQueue | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
538540

539541
ipconfig /allcompartments /all | Export-ObjectToFile -FilePath $outDir -Name 'ipconfig_allcompartments' -FileType txt -Force
540542
netsh winhttp show proxy | Export-ObjectToFile -FilePath $outDir -Name 'netsh_winhttp_show_proxy' -FileType txt -Force

src/modules/SdnDiag.Server.psm1

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -667,21 +667,11 @@ function Get-ServerConfigState {
667667
Get-SdnOvsdbPhysicalPort | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
668668
Get-SdnOvsdbUcastMacRemoteTable | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
669669

670-
# Gather Hyper-V network details
671-
"Gathering Hyper-V network configuration details" | Trace-Output -Level:Verbose
672-
Get-VM | Export-ObjectToFile -FilePath $outDir -FileType csv -Force
673-
Get-NetAdapterVPort | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
674-
Get-NetAdapterVmqQueue | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
675-
Get-SdnNetAdapterEncapOverheadConfig | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
676-
Get-SdnVMNetworkAdapterPortProfile -All | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
677-
Get-VMNetworkAdapterIsolation | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
678-
Get-VMNetworkAdapterVLAN | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
679-
Get-VMNetworkAdapterRoutingDomainMapping | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
680-
Get-VMSystemSwitchExtensionPortFeature -FeatureId "9940cd46-8b06-43bb-b9d5-93d50381fd56" | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
681-
Get-VMSwitchTeam | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
682-
683670
# enumerate the vm switches and gather details
684671
"Gathering VMSwitch details" | Trace-Output -Level:Verbose
672+
Get-SdnNetAdapterEncapOverheadConfig | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
673+
Get-VMSwitchTeam | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
674+
Get-VMSystemSwitchExtensionPortFeature -FeatureId "9940cd46-8b06-43bb-b9d5-93d50381fd56" | Export-ObjectToFile -FilePath $outDir -FileType txt -Format List
685675
$vmSwitch = Get-VMSwitch
686676
if ($vmSwitch) {
687677
$vmSwitchRootDir = New-Item -Path (Join-Path -Path $outDir -ChildPath "VMSwitch") -ItemType Directory -Force
@@ -711,6 +701,18 @@ function Get-ServerConfigState {
711701
"Failed to execute {0}" -f $cmd | Trace-Output -Level:Error
712702
}
713703
}
704+
705+
# Gather Hyper-V network details
706+
"Gathering Hyper-V VM and VMNetworkAdapter configuration details" | Trace-Output -Level:Verbose
707+
Get-VM | Export-ObjectToFile -FilePath $outDir -FileType csv -Force
708+
709+
# due to the number of properties returned from Get-VMNetworkAdapter, we need to export as a text file
710+
# otherwise it takes several minutes to write the data to the file and risks a timeout
711+
Get-VMNetworkAdapter -All | Export-ObjectToFile -FilePath $outDir -FileType txt -Format Table -Force
712+
Get-SdnVMNetworkAdapterPortProfile -All | Export-ObjectToFile -FilePath $outDir -FileType txt -Format Table -Force
713+
Get-VMNetworkAdapterIsolation | Export-ObjectToFile -FilePath $outDir -FileType txt -Format Table -Force
714+
Get-VMNetworkAdapterVLAN | Export-ObjectToFile -FilePath $outDir -FileType txt -Format Table -Force
715+
Get-VMNetworkAdapterRoutingDomainMapping | Export-ObjectToFile -FilePath $outDir -FileType txt -Format Table -Force
714716
}
715717
catch {
716718
$_ | Trace-Exception

0 commit comments

Comments
 (0)