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

NetIPInterface: AutomaticMetric set to disabled dosent work #391

Closed
VLoub opened this issue Apr 10, 2019 · 0 comments · Fixed by #472
Closed

NetIPInterface: AutomaticMetric set to disabled dosent work #391

VLoub opened this issue Apr 10, 2019 · 0 comments · Fixed by #472
Labels
enhancement The issue is an enhancement request.

Comments

@VLoub
Copy link

VLoub commented Apr 10, 2019

Details of the scenario you tried and the problem that is occurring

I needed to set metric of interface (not route) to highest value possible. So i needed to something like but in DSC.

Set-NetIPInterface -InterfaceIndex 6 -AutomaticMetric Disabled -InterfaceMetric 254

Verbose logs showing the problem

VERBOSE: [Server01]: LCM:  [ End    Resource ]  [[NetAdapterName]NameToISCSI]
VERBOSE: [Server01]: LCM:  [ Start  Resource ]  [[NetIPInterface]DisableDhcp]
VERBOSE: [Server01]: LCM:  [ Start  Test     ]  [[NetIPInterface]DisableDhcp]
VERBOSE: [Server01]:                            [[NetIPInterface]DisableDhcp] Test-TargetResource: Checking settings on net IP interface for alias 'iSCSI' and address family 'IPv4'.
VERBOSE: [Server01]:                            [[NetIPInterface]DisableDhcp] Get-NetworkIPInterface: Getting settings for net IP interface for alias 'iSCSI' and address family 'IPv4'.
VERBOSE: [Server01]:                            [[NetIPInterface]DisableDhcp] Test-TargetResource: The property 'AutomaticMetric' value 'Enabled' does not match the desired value 'Disabled'.
VERBOSE: [Server01]: LCM:  [ End    Test     ]  [[NetIPInterface]DisableDhcp]  in 0.0160 seconds.
VERBOSE: [Server01]: LCM:  [ Start  Set      ]  [[NetIPInterface]DisableDhcp]
VERBOSE: [Server01]:                            [[NetIPInterface]DisableDhcp] Set-TargetResource: Applying settings to net IP interface for alias 'iSCSI' and address family 'IPv4'.
VERBOSE: [Server01]:                            [[NetIPInterface]DisableDhcp] Get-NetworkIPInterface: Getting settings for net IP interface for alias 'iSCSI' and address family 'IPv4'.
VERBOSE: [Server01]:                            [[NetIPInterface]DisableDhcp] Set-TargetResource: Setting Net IP interface for alias 'iSCSI' and address family 'IPv4' parameter 'AutomaticMetric' to 'Disabled'.
The parameter is incorrect.
    + CategoryInfo          : InvalidArgument: (MSFT_NetIPInter...ystemName = ""):) [], CimException
    + FullyQualifiedErrorId : Windows System Error 87,Set-NetIPInterface
    + PSComputerName        : localhost
 
VERBOSE: [Server01]: LCM:  [ End    Set      ]  [[NetIPInterface]DisableDhcp]  in 0.5160 seconds.
The PowerShell DSC resource '[NetIPInterface]DisableDhcp' with SourceInfo 'C:\GitHub\WorkScripts\DSCiSCSIConfiguration.ps1::21::9::NetIPInterface' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called 
Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost
 
VERBOSE: [Server01]: LCM:  [ Start  Resource ]  [[IPAddress]NewIPv4Address]

Suggested solution to the issue

As you are ussing command Set-NetIPInterface when setting -AutomaticMetric to Disabled, there needs to be also specified parameter -InterfaceMetric.

I would like to have option in NetIPInterface to set InterfaceMetric directly. I will change this resource to set metric to 254 value when disabling auto metric, but its just my workaround.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

    NetIPInterface DisableDhcp
        {
            InterfaceAlias  = 'iSCSI'
            AddressFamily   = 'IPv4'
            AutomaticMetric = 'Disabled'
        }

The operating system the target node is running

OsName               : Microsoft Windows Server 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.2724.amd64fre.rs1_release.181231-1751
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value                                                                                                                                                                                                                                                                              
----                           -----                                                                                                                                                                                                                                                                              
PSVersion                      5.1.14393.2636                                                                                                                                                                                                                                                                     
PSEdition                      Desktop                                                                                                                                                                                                                                                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                                                                            
BuildVersion                   10.0.14393.2636                                                                                                                                                                                                                                                                    
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                                                                                    
WSManStackVersion              3.0                                                                                                                                                                                                                                                                                
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                                                                                
SerializationVersion           1.1.0.1    

Version of the DSC module that was used ('dev' if using current dev branch)

Name              : NetworkingDsc
Path              : C:\Program Files\WindowsPowerShell\Modules\NetworkingDsc\7.1.0.0\NetworkingDsc.psd1
Description       : Module with DSC Resources for Networking area
ModuleType        : Manifest
Version           : 7.1.0.0
@PlagueHO PlagueHO added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Apr 23, 2019
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants