-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from PowerShell/dev
Release of version 5.5.0.0 of xNetworking
- Loading branch information
Showing
58 changed files
with
3,919 additions
and
1,280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
217 changes: 217 additions & 0 deletions
217
...rking/DSCResources/MSFT_xNetAdapterAdvancedProperty/MSFT_xNetAdapterAdvancedProperty.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' | ||
|
||
# Import the Networking Common Modules | ||
Import-Module -Name (Join-Path -Path $modulePath ` | ||
-ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` | ||
-ChildPath 'NetworkingDsc.Common.psm1')) | ||
|
||
# Import the Networking Resource Helper Module | ||
Import-Module -Name (Join-Path -Path $modulePath ` | ||
-ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` | ||
-ChildPath 'NetworkingDsc.ResourceHelper.psm1')) | ||
|
||
# Import Localization Strings | ||
$localizedData = Get-LocalizedData ` | ||
-ResourceName 'MSFT_xNetAdapterAdvancedProperty' ` | ||
-ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) | ||
|
||
<# | ||
.SYNOPSIS | ||
Gets the current value of an advanced property. | ||
.PARAMETER NetworkAdapterName | ||
Specifies the Name of the network adapter to get the advanced property for. | ||
.PARAMETER RegistryKeyword | ||
Specifies the settings registrykeyword that should be in desired state. | ||
.PARAMETER RegistryValue | ||
Specifies the value of the settings. | ||
#> | ||
function Get-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.Collections.Hashtable])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$NetworkAdapterName, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[ValidateSet("*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete")] | ||
[System.String] | ||
$RegistryKeyword, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$RegistryValue | ||
) | ||
|
||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$localizedData.CheckingNetAdapterMessage | ||
) -join '') | ||
|
||
try | ||
{ | ||
$netAdapterAdvancedProperty = Get-NetAdapterAdvancedProperty -Name $networkAdapterName -RegistryKeyword $RegistryKeyword -ErrorAction Stop | ||
} | ||
catch | ||
{ | ||
New-InvalidOperationException ` | ||
-Message ($LocalizedData.NetAdapterNotFoundMessage) | ||
} | ||
|
||
if ($netAdapterAdvancedProperty) | ||
{ | ||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$($LocalizedData.NetAdapterTestingStateMessage -f $NetworkAdapterName, $RegistryKeyword) | ||
) -join '') | ||
|
||
$result = @{ | ||
Name = $NetworkAdapterName | ||
RegistryKeyword = $RegistryKeyword | ||
DisplayValue = $netAdapterAdvancedProperty.DisplayValue | ||
RegistryValue = $netAdapterAdvancedProperty.RegistryValue | ||
} | ||
|
||
return $result | ||
} | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Gets the current value of an advanced property. | ||
.PARAMETER NetworkAdapterName | ||
Specifies the Name of the network adapter to get the advanced property for. | ||
.PARAMETER RegistryKeyword | ||
Specifies the settings registrykeyword that should be in desired state. | ||
.PARAMETER RegistryValue | ||
Specifies the value of the settings. | ||
#> | ||
function Set-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$NetworkAdapterName, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[ValidateSet("*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete")] | ||
[System.String] | ||
$RegistryKeyword, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$RegistryValue | ||
) | ||
|
||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$localizedData.CheckingNetAdapterMessage | ||
) -join '') | ||
|
||
try | ||
{ | ||
$netAdapterAdvancedProperty = Get-NetAdapterAdvancedProperty -Name $networkAdapterName -RegistryKeyword $RegistryKeyword -ErrorAction Stop | ||
} | ||
catch | ||
{ | ||
New-InvalidOperationException ` | ||
-Message ($LocalizedData.NetAdapterNotFoundMessage) | ||
} | ||
|
||
if ($netAdapterAdvancedProperty) | ||
{ | ||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$($LocalizedData.NetAdapterTestingStateMessage -f $NetworkAdapterName, $RegistryKeyword) | ||
) -join '') | ||
|
||
if ($RegistryValue -ne $netAdapterAdvancedProperty.RegistryValue) | ||
{ | ||
$netadapterRegistryValue = $netAdapterAdvancedProperty.RegistryValue | ||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$($LocalizedData.NetAdapterApplyingChangesMessage -f ` | ||
$NetworkAdapterName, $RegistryKeyword, "$netadapterRegistryValue", $RegistryValue ) | ||
) -join '') | ||
|
||
Set-NetAdapterAdvancedProperty -RegistryValue $RegistryValue -Name $networkAdapterName -RegistryKeyword $RegistryKeyword | ||
} | ||
} | ||
} | ||
|
||
<# | ||
.SYNOPSIS | ||
Sets the current value of an advanced property. | ||
.PARAMETER NetworkAdapterName | ||
Specifies the Name of the network adapter to get the advanced property for. | ||
.PARAMETER RegistryKeyword | ||
Specifies the settings registrykeyword that should be in desired state. | ||
.PARAMETER RegistryValue | ||
Specifies the value of the settings. | ||
#> | ||
function Test-TargetResource | ||
{ | ||
[CmdletBinding()] | ||
[OutputType([System.Boolean])] | ||
param | ||
( | ||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$NetworkAdapterName, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[ValidateSet("*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete")] | ||
[System.String] | ||
$RegistryKeyword, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[System.String] | ||
$RegistryValue | ||
) | ||
|
||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$localizedData.CheckingNetAdapterMessage | ||
) -join '') | ||
|
||
try | ||
{ | ||
$netAdapterAdvancedProperty = Get-NetAdapterAdvancedProperty -Name $networkAdapterName -RegistryKeyword $RegistryKeyword -ErrorAction Stop | ||
} | ||
catch | ||
{ | ||
New-InvalidOperationException ` | ||
-Message ($LocalizedData.NetAdapterNotFoundMessage) | ||
} | ||
|
||
if ($netAdapterAdvancedProperty) | ||
{ | ||
Write-Verbose -Message ( @( | ||
"$($MyInvocation.MyCommand): " | ||
$localizedData.NetAdapterTestingStateMessage -f ` | ||
$NetworkAdapterName, $RegistryKeyword | ||
) -join '') | ||
|
||
if ($RegistryValue -eq $netAdapterAdvancedProperty.RegistryValue) | ||
{ | ||
return $true | ||
} | ||
else | ||
{ | ||
return $false | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...DSCResources/MSFT_xNetAdapterAdvancedProperty/MSFT_xNetAdapterAdvancedProperty.schema.mof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ClassVersion("1.0.0.0"), FriendlyName("xNetAdapterAdvancedProperty")] | ||
class MSFT_xNetAdapterAdvancedProperty : OMI_BaseResource | ||
{ | ||
[Key,ValueMap{"*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete"},Values{"*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete"},Description("Specifies the registrykeyword of the property that should be in desired state.")] String RegistryKeyword; | ||
[Required, Description("Specifies the network adapter name.")] String NetworkAdapterName; | ||
[Required, Description("Specifies the registryvalue.")] String RegistryValue; | ||
[Read, Description("Output Display value of selected RegistryKeyword.")] String DisplayValue; | ||
}; |
5 changes: 5 additions & 0 deletions
5
Modules/xNetworking/DSCResources/MSFT_xNetAdapterAdvancedProperty/README.MD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Description | ||
|
||
This resource is used to change advanced properties on a network adapter. | ||
Please check the supported registry values before creating a configuration. | ||
|
9 changes: 9 additions & 0 deletions
9
...rces/MSFT_xNetAdapterAdvancedProperty/en-US/MSFT_xNetAdapterAdvancedProperty.strings.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Localized resources for MSFT_xNetAdapterAdvancedProperty | ||
|
||
ConvertFrom-StringData @' | ||
CheckingNetAdapterMessage = Checking if network adapter exists or not. | ||
NetAdapterNotFoundMessage = Network adapter not found. | ||
NetAdapterTestingStateMessage = Checking if adapter {0} '{1}' is in desired state. | ||
NetAdapterIsInDesiredStateMessage = Network adapter {0} '{1}' is in desired state '{2}'. | ||
NetAdapterApplyingChangesMessage = Network adapter {0} '{1}' was '{2}', should be '{3}', applying changes. | ||
'@ |
Oops, something went wrong.