Get-NetAdapter returned nothing

Yes I did trying this command

PS C:\Windows\System32> Get-NetAdapter -IncludeHidden
PS C:\Windows\System32>

Thanks anyway :slight_smile:

Hmm … what does this return:

(Get-Command Get-NetAdapter).Definition

Might be worth a shot to compare to a working system.

OK let’s get crazy. Run these commands and let’s see what is going on.

Set-PSDebug -Trace 1
Get-NetAdapter -IncludeHidden
1 Like

I did a diff on the outputs, they are the same…

PS C:\Windows\system32> (Get-Command Get-NetAdapter).Definition

    [CmdletBinding(DefaultParameterSetName='ByName', PositionalBinding=$false)]

    [OutputType([Microsoft.Management.Infrastructure.CimInstance])]
[OutputType('Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter')]

    param(

    [Parameter(ParameterSetName='ByName', Position=0)]
    [Alias('ifAlias','InterfaceAlias')]
    [ValidateNotNull()]
    [string[]]
    ${Name},

    [Parameter(ParameterSetName='ByInstanceID', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
    [Alias('ifDesc')]
    [ValidateNotNull()]
    [string[]]
    ${InterfaceDescription},

    [Parameter(ParameterSetName='ByIfIndex', Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
    [Alias('ifIndex')]
    [ValidateNotNull()]
    [uint[]]
    ${InterfaceIndex},

    [Parameter(ParameterSetName='ByName')]
    [Parameter(ParameterSetName='ByInstanceID')]
    [Parameter(ParameterSetName='ByIfIndex')]
    [switch]
    ${IncludeHidden},

    [Parameter(ParameterSetName='ByName')]
    [Parameter(ParameterSetName='ByInstanceID')]
    [Parameter(ParameterSetName='ByIfIndex')]
    [switch]
    ${Physical},

    [Parameter(ParameterSetName='ByName')]
    [Parameter(ParameterSetName='ByInstanceID')]
    [Parameter(ParameterSetName='ByIfIndex')]
    [Alias('Session')]
    [ValidateNotNullOrEmpty()]
    [CimSession[]]
    ${CimSession},

    [Parameter(ParameterSetName='ByName')]
    [Parameter(ParameterSetName='ByInstanceID')]
    [Parameter(ParameterSetName='ByIfIndex')]
    [int]
    ${ThrottleLimit},

    [Parameter(ParameterSetName='ByName')]
    [Parameter(ParameterSetName='ByInstanceID')]
    [Parameter(ParameterSetName='ByIfIndex')]
    [switch]
    ${AsJob})

    DynamicParam {
        try
        {
            if (-not $__cmdletization_exceptionHasBeenThrown)
            {
                $__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()
                $__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)

                if ($__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])
                {
                    ([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()
                }
            }
        }
        catch
        {
            $__cmdletization_exceptionHasBeenThrown = $true
            throw
        }
    }

    Begin {
        $__cmdletization_exceptionHasBeenThrown = $false
        try
        {
            __cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters
            $__cmdletization_objectModelWrapper.BeginProcessing()
        }
        catch
        {
            $__cmdletization_exceptionHasBeenThrown = $true
            throw
        }
    }


    Process {
        try
        {
            if (-not $__cmdletization_exceptionHasBeenThrown)
            {
    $__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()
    if ($PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {
        $__cmdletization_values = @(${Name})
        $__cmdletization_queryBuilder.FilterByProperty('Name', $__cmdletization_values, $true, 'Default')
    }
    if ($PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {
        $__cmdletization_values = @(${InterfaceDescription})
        $__cmdletization_queryBuilder.FilterByProperty('InterfaceDescription', $__cmdletization_values, $true, 'Default')
    }
    if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
        $__cmdletization_values = @(${InterfaceIndex})
        $__cmdletization_queryBuilder.FilterByProperty('InterfaceIndex', $__cmdletization_values, $false, 'Default')
    }
    if ($PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
    $__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})
    }
    if ($PSBoundParameters.ContainsKey('Physical') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {
    $__cmdletization_queryBuilder.AddQueryOption('Physical', ${Physical})
    }


    $__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)
            }
        }
        catch
        {
            $__cmdletization_exceptionHasBeenThrown = $true
            throw
        }
    }


    End {
        try
        {
            if (-not $__cmdletization_exceptionHasBeenThrown)
            {
                $__cmdletization_objectModelWrapper.EndProcessing()
            }
        }
        catch
        {
            throw
        }
    }

    # .EXTERNALHELP MSFT_NetAdapter.cmdletDefinition.cdxml-Help.xml

PS C:\Windows\system32>

here you go, but not sure whats to note here…?

PS C:\Windows\System32> set-psdebug -trace 1
PS C:\Windows\System32> Get-NetAdapter -includehidden
DEBUG:    1+  >>>> Get-NetAdapter -includehidden
DEBUG:  104+     DynamicParam  >>>> {

DEBUG:  107+             if ( >>>> -not $__cmdletization_exceptionHasBeenThrown)

DEBUG:  109+                  >>>> $__cmdletization_objectModelWrapper = $script:ObjectModelWrapper::new()

DEBUG:  110+                  >>>> $__cmdletization_objectModelWrapper.Initialize($PSCmdlet, $script:ClassName, $script:ClassVersion, $script:ModuleVersion, $script:PrivateData)

DEBUG:  112+                 if ( >>>> $__cmdletization_objectModelWrapper -is [System.Management.Automation.IDynamicParameters])

DEBUG:  114+                      >>>> ([System.Management.Automation.IDynamicParameters]$__cmdletization_objectModelWrapper).GetDynamicParameters()

DEBUG:  123+      >>>> }

DEBUG:  125+     Begin  >>>> {

DEBUG:  126+          >>>> $__cmdletization_exceptionHasBeenThrown = $false

DEBUG:  129+              >>>> __cmdletization_BindCommonParameters $__cmdletization_objectModelWrapper $PSBoundParameters

DEBUG:   19+  >>>> {

DEBUG:   26+         if ( >>>> $myPSBoundParameters.ContainsKey('CimSession')) {

DEBUG:   31+         if ( >>>> $myPSBoundParameters.ContainsKey('ThrottleLimit')) {

DEBUG:   36+         if ( >>>> $myPSBoundParameters.ContainsKey('AsJob')) {

DEBUG:   41+  >>>> }

DEBUG:  130+              >>>> $__cmdletization_objectModelWrapper.BeginProcessing()

DEBUG:  137+      >>>> }

DEBUG:  140+     Process  >>>> {

DEBUG:  143+             if ( >>>> -not $__cmdletization_exceptionHasBeenThrown)

DEBUG:  145+      >>>> $__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQueryBuilder()

DEBUG:  146+     if ( >>>> $PSBoundParameters.ContainsKey('Name') -and (@('ByName') -contains $PSCmdlet.ParameterSetName )) {

DEBUG:  150+     if ( >>>> $PSBoundParameters.ContainsKey('InterfaceDescription') -and (@('ByInstanceID') -contains $PSCmdlet.ParameterSetName )) {

DEBUG:  154+     if ( >>>> $PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {

DEBUG:  158+     if ( >>>> $PSBoundParameters.ContainsKey('IncludeHidden') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {

DEBUG:  159+      >>>> $__cmdletization_queryBuilder.AddQueryOption('IncludeHidden', ${IncludeHidden})

DEBUG:  161+     if ( >>>> $PSBoundParameters.ContainsKey('Physical') -and (@('ByName', 'ByInstanceID', 'ByIfIndex') -contains $PSCmdlet.ParameterSetName )) {

DEBUG:  166+      >>>> $__cmdletization_objectModelWrapper.ProcessRecord($__cmdletization_queryBuilder)

DEBUG:  174+      >>>> }

DEBUG:  177+     End  >>>> {

DEBUG:  180+             if ( >>>> -not $__cmdletization_exceptionHasBeenThrown)

DEBUG:  182+                  >>>> $__cmdletization_objectModelWrapper.EndProcessing()

DEBUG:  189+      >>>> }

PS C:\Windows\System32>

Run the same thing in a working pc and you’ll see a lot more output. The net adapter cmdlet found no adapters. That’s wild since other commands do

yes, it shows much more stuff in a working pc…

Thanks all. I have resolved this issue by upgrading from Win10 to Win11 finally. Have a nice day!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.