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

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

Open
neckermann opened this issue Jun 15, 2023 · 0 comments

Comments

@neckermann
Copy link

neckermann commented Jun 15, 2023

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
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant