MSEndpointMgr / IntuneEnhancedInventory

Repository for the Intune Enhanced Inventory solution by MSEndpointmgr.com
MIT License
56 stars 17 forks source link

Suggestion to Invoke-CustomInventory and Invoke-CustomInventoryAzureFunction scripts #17

Open neckermann opened 1 year ago

neckermann commented 1 year ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like It would be great to add the driver details to the network adapter array.

Describe alternatives you've considered Plan on modifying myself in the script we use, but thought others might find it useful as well.

Additional context Possible solution

`

Get network adapters

$NetWorkArray = @()

$CurrentNetAdapters = Get-NetAdapter | Where-Object { $_.Status -eq 'Up' }

foreach ($CurrentNetAdapter in $CurrentNetAdapters) { try{ $IPConfiguration = Get-NetIPConfiguration -InterfaceIndex $CurrentNetAdapter[0].ifIndex -ErrorAction Stop } catch{ $IPConfiguration = $null }

try {
    $DriverVersion = (Get-CimInstance -ClassName win32_pnpsigneddriver -ErrorAction Stop | Where-Object {$_.description -like "$($CurrentNetAdapter.InterfaceDescription)"}).DriverVersion
}
catch {
    $DriverVersion = $null
}

$ComputerNetInterfaceDescription = $CurrentNetAdapter.InterfaceDescription
$ComputerNetProfileName = $IPConfiguration.NetProfile.Name
$ComputerNetIPv4Adress = $IPConfiguration.IPv4Address.IPAddress
$ComputerNetInterfaceAlias = $CurrentNetAdapter.InterfaceAlias
$ComputerNetIPv4DefaultGateway = $IPConfiguration.IPv4DefaultGateway.NextHop
$ComputerNetMacAddress = $CurrentNetAdapter.MacAddress

$tempnetwork = New-Object -TypeName PSObject
$tempnetwork | Add-Member -MemberType NoteProperty -Name "NetInterfaceDescription" -Value "$ComputerNetInterfaceDescription" -Force
$tempnetwork | Add-Member -MemberType NoteProperty -Name "NetProfileName" -Value "$ComputerNetProfileName" -Force
$tempnetwork | Add-Member -MemberType NoteProperty -Name "NetIPv4Adress" -Value "$ComputerNetIPv4Adress" -Force
$tempnetwork | Add-Member -MemberType NoteProperty -Name "NetInterfaceAlias" -Value "$ComputerNetInterfaceAlias" -Force
$tempnetwork | Add-Member -MemberType NoteProperty -Name "NetIPv4DefaultGateway" -Value "$ComputerNetIPv4DefaultGateway" -Force
$tempnetwork | Add-Member -MemberType NoteProperty -Name "MacAddress" -Value "$ComputerNetMacAddress" -Force
$tempnetwork | Add-Member -MemberType NoteProperty -Name "DriverVersion" -Value "$DriverVersion" -Force
$NetWorkArray += $tempnetwork

} [System.Collections.ArrayList]$NetWorkArrayList = $NetWorkArray `