### Full Network Configuration Example Source: https://context7.com/dsccommunity/networkingdsc/llms.txt A comprehensive example demonstrating the use of multiple NetworkingDsc resources to fully provision a Windows server's network stack, including adapter renaming, static IP configuration, DNS settings, hosts file entries, firewall rules, NetBIOS disabling, and proxy settings. ```powershell Configuration FullNetworkSetup { Import-DscResource -ModuleName NetworkingDsc Node 'WebServer01' { # 1. Rename adapter by MAC NetAdapterName RenameManagement { NewName = 'Management' MacAddress = 'AA-BB-CC-DD-EE-01' } # 2. Static IP on Management NIC NetIPInterface DisableDhcp { InterfaceAlias = 'Management' AddressFamily = 'IPv4' Dhcp = 'Disabled' DependsOn = '[NetAdapterName]RenameManagement' } IPAddress SetMgmtIP { IPAddress = '10.10.1.50/24' InterfaceAlias = 'Management' AddressFamily = 'IPv4' DependsOn = '[NetIPInterface]DisableDhcp' } DefaultGatewayAddress SetGateway { Address = '10.10.1.1' InterfaceAlias = 'Management' AddressFamily = 'IPv4' DependsOn = '[IPAddress]SetMgmtIP' } DnsServerAddress SetDns { Address = '10.10.1.2', '10.10.1.3' InterfaceAlias = 'Management' AddressFamily = 'IPv4' Validate = $true DependsOn = '[DefaultGatewayAddress]SetGateway' } # 3. DNS suffix search DnsClientGlobalSetting GlobalDns { IsSingleInstance = 'Yes' SuffixSearchList = 'corp.contoso.com', 'contoso.com' UseDevolution = $true DevolutionLevel = 0 } # 4. Hosts file entries for internal services HostsFile AddBuildAgent { HostName = 'build.corp.contoso.com' IPAddress = '10.10.2.100' Ensure = 'Present' } # 5. Firewall: allow HTTP/HTTPS inbound Firewall AllowHttp { Name = 'Allow-HTTP-In' Ensure = 'Present' Enabled = 'True' Direction = 'Inbound' Protocol = 'TCP' LocalPort = '80', '443' Profile = 'Domain', 'Private' } # 6. Disable NetBIOS everywhere NetBios DisableNetBios { InterfaceAlias = '*' Setting = 'Disable' } # 7. Proxy for outbound traffic ProxySettings SetProxy { Target = 'LocalMachine' Ensure = 'Present' EnableManualProxy = $true EnableAutoDetection = $false EnableAutoConfiguration = $false ProxyServer = 'proxy.corp.contoso.com:3128' ProxyServerBypassLocal = $true } } } # Compile and apply FullNetworkSetup -OutputPath 'C:\DSC\FullNetworkSetup' Start-DscConfiguration -Path 'C:\DSC\FullNetworkSetup' -Wait -Verbose -Force ``` -------------------------------- ### Install Gulp Globally Source: https://github.com/dsccommunity/networkingdsc/wiki/Running-Gulp-based-tests Installs the Gulp command-line tool globally on your system. This is a prerequisite for running Gulp tasks. ```bash npm install gulp --global ``` -------------------------------- ### Verify NetworkingDsc Installation Source: https://github.com/dsccommunity/networkingdsc/wiki/Home Run this command to confirm that the NetworkingDsc DSC resources have been successfully installed and are available. ```powershell Get-DscResource -Module NetworkingDsc ``` -------------------------------- ### Enable RDMA Settings Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterRdma Example configuration to enable RDMA settings on a network adapter named 'SMB1_1'. ```APIDOC ## Example 2: Enable RDMA Settings This configuration enables RDMA setting on the network adapter. ```powershell Configuration NetAdapterRdma_EnableRdmaSettings_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterRdma EnableRdmaSettings { Name = 'SMB1_1' Enabled = $true } } } ``` ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/dsccommunity/networkingdsc/wiki/Running-Gulp-based-tests Downloads and installs all the necessary Node.js modules required for the project, including Gulp plugins and task runners. This command should be run from the root of the NetworkingDsc repository. ```bash npm install ``` -------------------------------- ### Configure Firewall Rule with All Parameters Source: https://github.com/dsccommunity/networkingdsc/wiki/Firewall Demonstrates using all available parameters for the Firewall resource. This configuration is for example usage only and should not be deployed directly. ```powershell Configuration Firewall_AddFirewallRule_AllParameters_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { Firewall AddFirewallRuleAllParameters { Name = 'NotePadFirewallRule' DisplayName = 'Firewall Rule for Notepad.exe' Group = 'NotePad Firewall Rule Group' Ensure = 'Present' Enabled = 'True' Profile = ('Domain', 'Private') Direction = 'OutBound' RemotePort = ('8080', '8081') LocalPort = ('9080', '9081') Protocol = 'TCP' Description = 'Firewall Rule for Notepad.exe' Program = 'c:\windows\system32\notepad.exe' Service = 'WinRM' Authentication = 'Required' Encryption = 'Required' InterfaceAlias = 'Ethernet' InterfaceType = 'Wired' LocalAddress = ('192.168.2.0-192.168.2.128','192.168.1.0/255.255.255.0','10.0.0.0/8') LocalUser = 'O:LSD:(D;;CC;;;S-1-15-3-4)(A;;CC;;;S-1-5-21-3337988176-3917481366-464002247-1001)' Package = 'S-1-15-2-3676279713-3632409675-756843784-3388909659-2454753834-4233625902-1413163418' Platform = '6.1' RemoteAddress = ('192.168.2.0-192.168.2.128','192.168.1.0/255.255.255.0','10.0.0.0/8') RemoteMachine = 'O:LSD:(D;;CC;;;S-1-5-21-1915925333-479612515-2636650677-1621)(A;;CC;;;S-1-5-21-1915925333-479612515-2636650677-1620)' RemoteUser = 'O:LSD:(D;;CC;;;S-1-15-3-4)(A;;CC;;;S-1-5-21-3337988176-3917481366-464002247-1001)' DynamicTransport = 'ProximitySharing' EdgeTraversalPolicy = 'Block' IcmpType = ('51','52') LocalOnlyMapping = $true LooseSourceMapping = $true OverrideBlockRules = $true Owner = 'S-1-5-21-3337988176-3917481366-464002247-500' } } } ``` -------------------------------- ### Install and Import NetworkingDsc Module Source: https://context7.com/dsccommunity/networkingdsc/llms.txt Installs the NetworkingDsc module from the PowerShell Gallery and imports it for use in DSC configurations. ```powershell # Install from PowerShell Gallery Install-Module -Name NetworkingDsc -Repository PSGallery # Import in a configuration Import-DscResource -ModuleName NetworkingDsc ``` -------------------------------- ### ConfigurePrivateFirewallProfile Source: https://github.com/dsccommunity/networkingdsc/wiki/FirewallProfile Example of configuring the Private Firewall Profile using the FirewallProfile resource. ```APIDOC ## FirewallProfile ### Description This resource is used to enable or disable and configure Windows Firewall with Advanced Security profiles. ### Parameters #### Path Parameters - **Name** (String) - Required - The name of the firewall profile to configure. Allowed Values: `Domain`, `Public`, `Private` #### Query Parameters - **AllowInboundRules** (String) - Write - Specifies that the firewall blocks inbound traffic. Allowed Values: `True`, `False`, `NotConfigured` - **AllowLocalFirewallRules** (String) - Write - Specifies that the local firewall rules should be merged into the effective policy along with Group Policy settings. Allowed Values: `True`, `False`, `NotConfigured` - **AllowLocalIPsecRules** (String) - Write - Specifies that the local IPsec rules should be merged into the effective policy along with Group Policy settings. Allowed Values: `True`, `False`, `NotConfigured` - **AllowUnicastResponseToMulticast** (String) - Write - Allows unicast responses to multi-cast traffic. Allowed Values: `True`, `False`, `NotConfigured` - **AllowUserApps** (String) - Write - Specifies that traffic from local user applications is allowed through the firewall. Allowed Values: `True`, `False`, `NotConfigured` - **AllowUserPorts** (String) - Write - Specifies that traffic is allowed through local user ports. Allowed Values: `True`, `False`, `NotConfigured` - **DefaultInboundAction** (String) - Write - Specifies how to filter inbound traffic. Allowed Values: `Block`, `Allow`, `NotConfigured` - **DefaultOutboundAction** (String) - Write - Specifies how to filter outbound traffic. Allowed Values: `Block`, `Allow`, `NotConfigured` - **DisabledInterfaceAliases** (StringArray[]) - Write - Specifies a list of interfaces on which firewall settings are excluded. - **Enabled** (String) - Write - Specifies that devolution is activated. Allowed Values: `True`, `False`, `NotConfigured` - **EnableStealthModeForIPsec** (String) - Write - Enables stealth mode for IPsec traffic. Allowed Values: `True`, `False`, `NotConfigured` - **LogAllowed** (String) - Write - Specifies how to log the allowed packets in the location specified by the LogFileName parameter. Allowed Values: `True`, `False`, `NotConfigured` - **LogBlocked** (String) - Write - Specifies how to log the dropped packets in the location specified by the LogFileName parameter. Allowed Values: `True`, `False`, `NotConfigured` - **LogFileName** (String) - Write - Specifies the path and filename of the file to which Windows Server writes log entries. - **LogIgnored** (String) - Write - Specifies how to log the ignored packets in the location specified by the LogFileName parameter. Allowed Values: `True`, `False`, `NotConfigured` - **LogMaxSizeKilobytes** (UInt64) - Write - Specifies the maximum file size of the log, in kilobytes. The acceptable values for this parameter are: 1 through 32767. - **NotifyOnListen** (String) - Write - Allows the notification of listening for inbound connections by a service. Allowed Values: `True`, `False`, `NotConfigured` ### Request Example ```powershell Configuration FirewallProfile_ConfigurePrivateFirewallProfile_Config { Import-DscResource -Module NetworkingDsc Node localhost { FirewallProfile ConfigurePrivateFirewallProfile { Name = 'Private' Enabled = 'True' DefaultInboundAction = 'Block' DefaultOutboundAction = 'Allow' AllowInboundRules = 'True' AllowLocalFirewallRules = 'False' AllowLocalIPsecRules = 'False' NotifyOnListen = 'True' LogFileName = '%systemroot%\system32\LogFiles\Firewall\pfirewall.log' LogMaxSizeKilobytes = 16384 LogAllowed = 'False' LogBlocked = 'True' LogIgnored = 'NotConfigured' } } } ``` ``` -------------------------------- ### Enabling DHCP Client and DNS Source: https://github.com/dsccommunity/networkingdsc/wiki/DhcpClient This example demonstrates how to enable the DHCP client and configure DNS settings for a specific network interface (e.g., 'Ethernet') using the DhcpClient resource. ```APIDOC ## DhcpClient Configuration Example ### Description This example shows how to configure the DhcpClient resource to enable DHCP for both IP address and DNS resolution on a network interface. ### Resource - **DhcpClient** - **State**: 'Enabled' - **InterfaceAlias**: 'Ethernet' - **AddressFamily**: 'IPv4' - **DnsServerAddress** - **InterfaceAlias**: 'Ethernet' - **AddressFamily**: 'IPv4' ### Example Usage ```powershell Configuration Example { param ( [Parameter()] [System.String[]] $NodeName = 'localhost' ) Import-DscResource -Module NetworkingDsc Node $NodeName { DhcpClient EnableDhcpClient { State = 'Enabled' InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } DnsServerAddress EnableDhcpDNS { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } } } ``` ``` -------------------------------- ### Configure Private Firewall Profile Source: https://github.com/dsccommunity/networkingdsc/wiki/FirewallProfile This example configures the 'Private' firewall profile. It enables the firewall, sets default inbound and outbound actions, and specifies logging parameters. ```powershell Configuration FirewallProfile_ConfigurePrivateFirewallProfile_Config { Import-DscResource -Module NetworkingDsc Node localhost { FirewallProfile ConfigurePrivateFirewallProfile { Name = 'Private' Enabled = 'True' DefaultInboundAction = 'Block' DefaultOutboundAction = 'Allow' AllowInboundRules = 'True' AllowLocalFirewallRules = 'False' AllowLocalIPsecRules = 'False' NotifyOnListen = 'True' LogFileName = '%systemroot%\system32\LogFiles\Firewall\pfirewall.log' LogMaxSizeKilobytes = 16384 LogAllowed = 'False' LogBlocked = 'True' LogIgnored = 'NotConfigured' } } } ``` -------------------------------- ### Configure WINS Server Address Source: https://github.com/dsccommunity/networkingdsc/wiki/WinsServerAddress This example shows how to configure a single WINS server address for a network interface. ```APIDOC ## WinsServerAddress ### Description This resource is used to control a node's WINS Server address(s) for the given network interface. ### Parameters #### Parameters - **InterfaceAlias** (String) - Required - Alias of the network interface for which the WINS server address is set. - **Address** (StringArray[]) - Write - The desired WINS Server address(es). Exclude to remove all WINS servers. ### Request Example ```powershell Configuration WinsServerAddress_Config { Import-DscResource -Module NetworkingDsc Node localhost { WinsServerAddress WinsServerAddress { Address = '192.168.0.1' InterfaceAlias = 'Ethernet' } } } ``` ``` -------------------------------- ### Configure Primary and Secondary WINS Server Addresses Source: https://github.com/dsccommunity/networkingdsc/wiki/WinsServerAddress This example demonstrates configuring both primary and secondary WINS server addresses for a network interface. ```APIDOC ## WinsServerAddress ### Description This resource is used to control a node's WINS Server address(s) for the given network interface. ### Parameters #### Parameters - **InterfaceAlias** (String) - Required - Alias of the network interface for which the WINS server address is set. - **Address** (StringArray[]) - Write - The desired WINS Server address(es). Exclude to remove all WINS servers. ### Request Example ```powershell Configuration WinsServerAddress_PrimaryAndSecondary_Config { Import-DscResource -Module NetworkingDsc Node localhost { WinsServerAddress PrimaryAndSecondary { Address = '192.168.0.1', '192.168.0.2' InterfaceAlias = 'Ethernet' } } } ``` ``` -------------------------------- ### Set Public Network with Internet Connectivity Source: https://github.com/dsccommunity/networkingdsc/wiki/NetConnectionProfile This example demonstrates how to configure the Ethernet adapter to be part of a Public network and set both IPv4 and IPv6 connectivity to Internet. ```APIDOC ## NetConnectionProfile ### Description This resource is used to set a node's connection profile. ### Parameters #### Path Parameters - **InterfaceAlias** (String) - Required - Specifies the alias for the Interface that is being changed. #### Query Parameters - **NetworkCategory** (String) - Required - Specifies the network category. Allowed values: `Public`, `Private`. - **IPv4Connectivity** (String) - Optional - Sets the Network Category for the interface. Allowed values: `Disconnected`, `NoTraffic`, `Subnet`, `LocalNetwork`, `Internet`. - **IPv6Connectivity** (String) - Optional - Specifies the IPv4 Connection Value. Allowed values: `Disconnected`, `NoTraffic`, `Subnet`, `LocalNetwork`, `Internet`. ### Request Example ```powershell Configuration NetConnectionProfile_SetPublicEnableInternet_Config { Import-DscResource -Module NetworkingDsc Node localhost { NetConnectionProfile SetPublicEnableInternet { InterfaceAlias = 'Ethernet' NetworkCategory = 'Public' IPv4Connectivity = 'Internet' IPv6Connectivity = 'Internet' } } } ``` ``` -------------------------------- ### Create and Configure Network Team Source: https://github.com/dsccommunity/networkingdsc/wiki/NetworkTeam This example demonstrates how to create a switch-independent network team named 'HostTeam' using specified network interfaces and load balancing algorithm. It also includes a WaitForNetworkTeam resource to ensure the team achieves an 'Up' status before proceeding. ```APIDOC ## NetworkTeam Resource ### Description This resource is used to setup network teams on a node. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **Name** (String) - Required - Specifies the name of the network team to create. - **TeamMembers** (StringArray[]) - Required - Specifies the network interfaces that should be a part of the network team. This is a comma-separated list. - **Ensure** (String) - Optional - Specifies if the network team should be created or deleted. Defaults to 'Present'. Allowed values: `Present`, `Absent`. - **LoadBalancingAlgorithm** (String) - Optional - Specifies the load balancing algorithm for the network team. Allowed values: `Dynamic`, `HyperVPort`, `IPAddresses`, `MacAddresses`, `TransportPorts`. - **TeamingMode** (String) - Optional - Specifies the teaming mode configuration. Allowed values: `SwitchIndependent`, `LACP`, `Static`. ### Request Example ```powershell Configuration NetworkTeam_AddNetworkTeam_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetworkTeam AddNetworkTeam { Name = 'HostTeam' TeamingMode = 'SwitchIndependent' LoadBalancingAlgorithm = 'HyperVPort' TeamMembers = 'NIC1', 'NIC2' Ensure = 'Present' } WaitForNetworkTeam WaitForHostTeam { Name = 'HostTeam' DependsOn = '[NetworkTeam]AddNetworkTeam' } } } ``` ### Response #### Success Response (200) - **NetworkTeam** (Object) - Represents the configured network team. #### Response Example (No specific response body schema provided in source, but implies successful configuration of the NetworkTeam resource.) ``` -------------------------------- ### Install NetworkingDsc Module Source: https://github.com/dsccommunity/networkingdsc/wiki/Home Use this command to install the NetworkingDsc module from the PowerShell Gallery. Ensure you are using PowerShell 5.0 or later. ```powershell Find-Module -Name NetworkingDsc -Repository PSGallery | Install-Module ``` -------------------------------- ### Set Default Gateway Source: https://github.com/dsccommunity/networkingdsc/wiki/DefaultGatewayAddress This example shows how to set the IPv4 default gateway for the 'Ethernet' interface to '192.168.1.1'. ```APIDOC ## Set Default Gateway ### Description Sets a specific default gateway address for a network interface. ### Parameters #### Path Parameters - **InterfaceAlias** (String) - Required - The alias of the network interface. - **AddressFamily** (String) - Required - The IP address family (IPv4 or IPv6). - **Address** (String) - Optional - The desired default gateway address. If not provided, the default gateway will be removed. ### Request Example ```powershell Configuration DefaultGatewayAddress_SetDefaultGateway_Config { Import-DscResource -Module NetworkingDsc Node localhost { DefaultGatewayAddress SetDefaultGateway { Address = '192.168.1.1' InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } } } ``` ``` -------------------------------- ### Add Static IPv4 and IPv6 Addresses (Specified Prefixes) Source: https://github.com/dsccommunity/networkingdsc/wiki/IPAddress Configure static IPv4 and IPv6 addresses with specific CIDR prefix lengths by providing the IP address and prefix in CIDR notation. This example explicitly sets the prefix for both address types. ```powershell Configuration IPAddress_AddingStaticIPWithPrefix_Config { Import-DscResource -Module NetworkingDsc Node localhost { NetIPInterface DisableDhcp { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv6' Dhcp = 'Disabled' } IPAddress NewIPv6Address { IPAddress = '2001:4898:200:7:6c71:a102:ebd8:f482/64' InterfaceAlias = 'Ethernet' AddressFamily = 'IPV6' } IPAddress NewIPv4Address { IPAddress = '192.168.10.5/24' InterfaceAlias = 'Ethernet' AddressFamily = 'IPV4' } } } ``` -------------------------------- ### Rename Network Adapters by MAC Address and Enable DHCP Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterName This example demonstrates renaming three network adapters using their MAC addresses and then enabling DHCP for each. Ensure the MAC addresses are correct for your environment. ```powershell Configuration NetAdapterName_RenameNetAdapterMacAddress_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterName RenameNetAdapterCluster { NewName = 'Cluster' MacAddress = '9C-D2-1E-61-B5-DA' } NetIPInterface EnableDhcpClientCluster { InterfaceAlias = 'Cluster' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterManagement { NewName = 'Management' MacAddress = '9C-D2-1E-61-B5-DB' } NetIPInterface EnableDhcpClientManagement { InterfaceAlias = 'Management' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterSMB { NewName = 'SMB' MacAddress = '9C-D2-1E-61-B5-DC' } NetIPInterface EnableDhcpClientSMB { InterfaceAlias = 'SMB' AddressFamily = 'IPv4' Dhcp = 'Enabled' } } } ``` -------------------------------- ### Rename Network Adapter by Driver Description Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterName This example shows how to rename network adapters based on their driver descriptions. It renames adapters sequentially and configures their IP interfaces for DHCP. ```APIDOC ## NetAdapterName Resource - Rename by Driver Description ### Description This configuration renames the first three network adapters matching the 'Hyper-V Virtual Ethernet Adapter' driver description. The adapters are renamed sequentially to 'Cluster', 'Management', and 'SMB', and their IP interfaces are configured to use DHCP for IPv4. ### Parameters #### NetAdapterName Resource Parameters - **NewName** (String) - Required - Specifies the new name of the network adapter. - **DriverDescription** (String) - Required - This is the driver description of the network adapter. - **InterfaceNumber** (UInt32) - Optional - This is the interface number of the network adapter if more than one are returned by the parameters. #### NetIPInterface Resource Parameters - **InterfaceAlias** (String) - Required - The alias of the network interface to configure. - **AddressFamily** (String) - Required - The address family of the IP interface (e.g., 'IPv4'). - **Dhcp** (String) - Required - Specifies whether DHCP is enabled ('Enabled' or 'Disabled'). ### Example Configuration ```powershell Configuration NetAdapterName_RenameNetAdapterDriver_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterName RenameNetAdapterCluster { NewName = 'Cluster' DriverDescription = 'Hyper-V Virtual Ethernet Adapter' InterfaceNumber = 1 } NetIPInterface EnableDhcpClientCluster { InterfaceAlias = 'Cluster' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterManagement { NewName = 'Management' DriverDescription = 'Hyper-V Virtual Ethernet Adapter' InterfaceNumber = 2 } NetIPInterface EnableDhcpClientManagement { InterfaceAlias = 'Management' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterSMB { NewName = 'SMB' DriverDescription = 'Hyper-V Virtual Ethernet Adapter' InterfaceNumber = 3 } NetIPInterface EnableDhcpClientSMB { InterfaceAlias = 'SMB' AddressFamily = 'IPv4' Dhcp = 'Enabled' } } } ``` ``` -------------------------------- ### WeakHostSend Configuration Source: https://github.com/dsccommunity/networkingdsc/wiki/WeakHostSend This example demonstrates how to disable the weak host send setting for a network adapter with the alias 'Ethernet' using PowerShell DSC. ```APIDOC ## WeakHostSend ### Description This resource is used to control the weak host send setting on an interface for a node. ### Parameters #### Path Parameters - **InterfaceAlias** (string) - Required - Alias of the network interface for which the Weak Host Sending is set. - **AddressFamily** (string) - Required - IP address family. Allowed values: IPv4, IPv6. #### Query Parameters - **State** (string) - Required - The desired state of the Weak Host Sending. Allowed values: Enabled, Disabled. ### Request Example ```powershell Configuration Example { param ( [Parameter()] [System.String[]] $NodeName = 'localhost' ) Import-DscResource -Module NetworkingDsc Node $NodeName { WeakHostSend DisableWeakHostSending { State = 'Disabled' InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } } } ``` ### Response This resource does not have a direct response body as it is used for configuration. The success or failure would be determined by the DSC engine execution. ``` -------------------------------- ### Rename Network Adapter by MAC Address Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterName This example demonstrates how to rename network adapters using their MAC addresses. It also shows how to configure IP interfaces to use DHCP after renaming. ```APIDOC ## NetAdapterName Resource - Rename by MAC Address ### Description This configuration renames three network adapters identified by their MAC addresses to 'Cluster', 'Management', and 'SMB'. It also configures their respective IP interfaces to use DHCP for IPv4. ### Parameters #### NetAdapterName Resource Parameters - **NewName** (String) - Required - Specifies the new name of the network adapter. - **MacAddress** (String) - Required - This is the MAC address of the network adapter to find. #### NetIPInterface Resource Parameters - **InterfaceAlias** (String) - Required - The alias of the network interface to configure. - **AddressFamily** (String) - Required - The address family of the IP interface (e.g., 'IPv4'). - **Dhcp** (String) - Required - Specifies whether DHCP is enabled ('Enabled' or 'Disabled'). ### Example Configuration ```powershell Configuration NetAdapterName_RenameNetAdapterMacAddress_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterName RenameNetAdapterCluster { NewName = 'Cluster' MacAddress = '9C-D2-1E-61-B5-DA' } NetIPInterface EnableDhcpClientCluster { InterfaceAlias = 'Cluster' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterManagement { NewName = 'Management' MacAddress = '9C-D2-1E-61-B5-DB' } NetIPInterface EnableDhcpClientManagement { InterfaceAlias = 'Management' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterSMB { NewName = 'SMB' MacAddress = '9C-D2-1E-61-B5-DC' } NetIPInterface EnableDhcpClientSMB { InterfaceAlias = 'SMB' AddressFamily = 'IPv4' Dhcp = 'Enabled' } } } ``` ``` -------------------------------- ### Disable NetBIOS on All Adapters using Wildcard Source: https://github.com/dsccommunity/networkingdsc/wiki/NetBios This example demonstrates disabling NetBIOS on all network interfaces by using a wildcard character for the InterfaceAlias. The NetworkingDsc module must be imported. ```powershell Configuration NetBios_DisableNetBios_Config_Wildcard { Import-DscResource -ModuleName NetworkingDsc Node localhost { NetBios DisableNetBios { InterfaceAlias = '*' Setting = 'Disable' } } } ``` -------------------------------- ### Disable RDMA Settings Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterRdma Example configuration to disable RDMA settings on a network adapter named 'SMB1_1'. ```APIDOC ## Example 1: Disable RDMA Settings This configuration disables RDMA setting on the network adapter. ```powershell Configuration NetAdapterRdma_DisableRdmaSettings_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterRdma DisableRdmaSettings { Name = 'SMB1_1' Enabled = $false } } } ``` ``` -------------------------------- ### Rename Network Adapters by Driver Description and Enable DHCP Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterName This example renames the first three network adapters matching a specific driver description to Cluster, Management, and SMB, then enables DHCP. The InterfaceNumber parameter is crucial for selecting specific adapters when multiple share the same driver description. ```powershell Configuration NetAdapterName_RenameNetAdapterDriver_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterName RenameNetAdapterCluster { NewName = 'Cluster' DriverDescription = 'Hyper-V Virtual Ethernet Adapter' InterfaceNumber = 1 } NetIPInterface EnableDhcpClientCluster { InterfaceAlias = 'Cluster' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterManagement { NewName = 'Management' DriverDescription = 'Hyper-V Virtual Ethernet Adapter' InterfaceNumber = 2 } NetIPInterface EnableDhcpClientManagement { InterfaceAlias = 'Management' AddressFamily = 'IPv4' Dhcp = 'Enabled' } NetAdapterName RenameNetAdapterSMB { NewName = 'SMB' DriverDescription = 'Hyper-V Virtual Ethernet Adapter' InterfaceNumber = 3 } NetIPInterface EnableDhcpClientSMB { InterfaceAlias = 'SMB' AddressFamily = 'IPv4' Dhcp = 'Enabled' } } } ``` -------------------------------- ### Add New Network Team Interface Source: https://github.com/dsccommunity/networkingdsc/wiki/NetworkTeamInterface This example demonstrates how to add a new network interface to an existing network team. It configures the interface name, associates it with a team, sets a VLAN ID, and ensures the interface is present. ```APIDOC ## NetworkTeamInterface Resource ### Description This resource is used to add network interfaces to a network team. ### Parameters #### Path Parameters - **Name** (String) - Required - Specifies the name of the network team interface to create. - **TeamName** (String) - Required - Specifies the name of the network team on which this particular interface should exist. - **Ensure** (String) - Optional - Specifies if the network team interface should be created or deleted. Defaults to 'Present'. Allowed values: `Present`, `Absent`. - **VlanId** (UInt32) - Optional - Specifies VLAN ID to be set on network team interface. ### Request Example ```powershell Configuration NetworkTeamInterface_AddInterface_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetworkTeam HostTeam { Name = 'HostTeam' TeamingMode = 'SwitchIndependent' LoadBalancingAlgorithm = 'HyperVPort' TeamMembers = 'NIC1','NIC2' Ensure = 'Present' } NetworkTeamInterface NewInterface { Name = 'NewInterface' TeamName = 'HostTeam' VlanID = 100 Ensure = 'Present' DependsOn = '[NetworkTeam]HostTeam' } } } ``` ``` -------------------------------- ### Enable Built-in Firewall Rule Source: https://github.com/dsccommunity/networkingdsc/wiki/Firewall Enables a pre-existing firewall rule by its name. This example enables the 'World Wide Web Services (HTTP Traffic-In)' rule. ```powershell Configuration Firewall_EnableBuiltInFirewallRule_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { Firewall EnableBuiltInFirewallRule { Name = 'IIS-WebServerRole-HTTP-In-TCP' Ensure = 'Present' Enabled = 'True' } } } ``` -------------------------------- ### Set Private Network without Changing Connectivity Source: https://github.com/dsccommunity/networkingdsc/wiki/NetConnectionProfile This example shows how to set the Ethernet adapter to a Private network category without altering the existing IPv4 or IPv6 connectivity settings. ```APIDOC ## NetConnectionProfile ### Description This resource is used to set a node's connection profile. ### Parameters #### Path Parameters - **InterfaceAlias** (String) - Required - Specifies the alias for the Interface that is being changed. #### Query Parameters - **NetworkCategory** (String) - Required - Specifies the network category. Allowed values: `Public`, `Private`. - **IPv4Connectivity** (String) - Optional - Sets the Network Category for the interface. Allowed values: `Disconnected`, `NoTraffic`, `Subnet`, `LocalNetwork`, `Internet`. - **IPv6Connectivity** (String) - Optional - Specifies the IPv4 Connection Value. Allowed values: `Disconnected`, `NoTraffic`, `Subnet`, `LocalNetwork`, `Internet`. ### Request Example ```powershell Configuration NetConnectionProfile_SetPrivate_Config { Import-DscResource -Module NetworkingDsc Node localhost { NetConnectionProfile SetPrivate { InterfaceAlias = 'Ethernet' NetworkCategory = 'Private' } } } ``` ``` -------------------------------- ### Enable DHCP for IPv4 Address and DNS Source: https://github.com/dsccommunity/networkingdsc/wiki/DnsServerAddress Disables static DNS server configuration by enabling DHCP for the network interface. This example uses NetIPInterface to enable DHCP and DnsServerAddress to ensure no static DNS is set. ```powershell Configuration DnsServerAddress_EnableDHCP_Config { Import-DscResource -Module NetworkingDsc Node localhost { NetIPInterface EnableDhcp { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' Dhcp = 'Enabled' } DnsServerAddress EnableDhcpDNS { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } } } ``` -------------------------------- ### Disable LSO for IPv4 Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterLso Example configuration to disable LSO for the IPv4 protocol on the 'Ethernet' network adapter. ```APIDOC ## Example: Disable LSO for IPv4 ```powershell Configuration NetAdapterLso_DisableLsoIPv4_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterLso DisableLsoIPv4 { Name = 'Ethernet' Protocol = 'IPv4' State = $false } } } ``` ``` -------------------------------- ### Disable LSO for IPv6 Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterLso Example configuration to disable LSO for the IPv6 protocol on the 'Ethernet' network adapter. ```APIDOC ## Example: Disable LSO for IPv6 ```powershell Configuration NetAdapterLso_DisableLsoIPv6_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterLso DisableLsoIPv6 { Name = 'Ethernet' Protocol = 'IPv6' State = $false } } } ``` ``` -------------------------------- ### Remove Network Team Source: https://github.com/dsccommunity/networkingdsc/wiki/NetworkTeam This example shows how to remove a network team named 'HostTeam' from the specified network interfaces. ```APIDOC ## NetworkTeam Resource - Removal ### Description This resource can be used to remove a network team from a node. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **Name** (String) - Required - Specifies the name of the network team to remove. - **TeamMembers** (StringArray[]) - Required - Specifies the network interfaces that were part of the network team. This is a comma-separated list. - **Ensure** (String) - Required - Set to 'Absent' to remove the network team. Allowed values: `Absent`. ### Request Example ```powershell Configuration NetworkTeam_RemoveNetworkTeam_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetworkTeam RemoveNetworkTeam { Name = 'HostTeam' Ensure = 'Absent' TeamMembers = 'NIC1', 'NIC2', 'NIC3' } } } ``` ### Response #### Success Response (200) - **NetworkTeam** (Object) - Indicates the successful removal of the network team. #### Response Example (No specific response body schema provided in source, but implies successful removal of the NetworkTeam resource.) ``` -------------------------------- ### Remove Default Gateway Source: https://github.com/dsccommunity/networkingdsc/wiki/DefaultGatewayAddress This example demonstrates how to remove the IPv4 default gateway from a network interface named 'Ethernet'. ```APIDOC ## Remove Default Gateway ### Description Removes the default gateway for a specified network interface. ### Parameters #### Path Parameters - **InterfaceAlias** (String) - Required - The alias of the network interface. - **AddressFamily** (String) - Required - The IP address family (IPv4 or IPv6). ### Request Example ```powershell Configuration DefaultGatewayAddress_RemoveDefaultGateway_Config { Import-DscResource -Module NetworkingDsc Node localhost { DefaultGatewayAddress RemoveDefaultGateway { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } } } ``` ``` -------------------------------- ### Remove a Network Team Interface Source: https://github.com/dsccommunity/networkingdsc/wiki/NetworkTeamInterface This example shows how to remove a network interface from a network team by setting the Ensure parameter to 'Absent'. ```APIDOC ## NetworkTeamInterface Resource ### Description This resource is used to remove network interfaces from a network team. ### Parameters #### Path Parameters - **Name** (String) - Required - Specifies the name of the network team interface to remove. - **TeamName** (String) - Required - Specifies the name of the network team from which this particular interface should be removed. - **Ensure** (String) - Optional - Specifies if the network team interface should be created or deleted. Defaults to 'Present'. Allowed values: `Present`, `Absent`. ### Request Example ```powershell Configuration NetworkTeamInterface_RemoveInterface_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetworkTeam HostTeam { Name = 'HostTeam' TeamingMode = 'SwitchIndependent' LoadBalancingAlgorithm = 'HyperVPort' TeamMembers = 'NIC1','NIC2' Ensure = 'Present' } NetworkTeamInterface NewInterface { Name = 'NewInterface' TeamName = 'HostTeam' Ensure = 'Absent' DependsOn = '[NetworkTeam]HostTeam' } } } ``` ``` -------------------------------- ### Enable Network Adapter using NetAdapterState Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterState This configuration enables a network adapter named 'Ethernet'. Ensure the NetworkingDsc module is imported. ```powershell Configuration NetAdapterState_Enable_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterState EnableEthernet { Name = 'Ethernet' State = 'Enabled' } } } ``` -------------------------------- ### Configure Multiple NetIPInterface Settings Source: https://github.com/dsccommunity/networkingdsc/wiki/NetIPInterface Enables various IPv4 settings on a network interface with alias 'Ethernet', including default route advertisement, advertising, automatic metric, Wake On LAN patterns, forwarding, default route ignoring, managed address configuration, neighbor unreachability detection, other stateful configuration, router discovery, and sets the MTU. The EcnMarking parameter is set to 'AppDecide'. ```powershell Configuration NetIPInterface_MultipleSettings_Config { Import-DscResource -Module NetworkingDsc Node localhost { NetIPInterface MultipleSettings { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' AdvertiseDefaultRoute = 'Enabled' Advertising = 'Enabled' AutomaticMetric = 'Enabled' DirectedMacWolPattern = 'Enabled' EcnMarking = 'AppDecide' ForceArpNdWolPattern = 'Enabled' Forwarding = 'Enabled' IgnoreDefaultRoutes = 'Enabled' ManagedAddressConfiguration = 'Enabled' NeighborUnreachabilityDetection = 'Enabled' OtherStatefulConfiguration = 'Enabled' RouterDiscovery = 'Enabled' NlMtu = 1576 } } } ``` -------------------------------- ### Enable DHCP Client and DNS for an Interface Source: https://github.com/dsccommunity/networkingdsc/wiki/DhcpClient Enables DHCP for both IP address assignment and DNS configuration on a specified network interface. Ensure the NetworkingDsc module is imported. ```powershell Configuration Example { param ( [Parameter()] [System.String[]] $NodeName = 'localhost' ) Import-DscResource -Module NetworkingDsc Node $NodeName { DhcpClient EnableDhcpClient { State = 'Enabled' InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } DnsServerAddress EnableDhcpDNS { InterfaceAlias = 'Ethernet' AddressFamily = 'IPv4' } } } ``` -------------------------------- ### Enable RDMA on Network Adapter Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterRdma Use this configuration to enable RDMA settings on a specific network adapter. Ensure the NetworkingDsc module is imported. ```powershell Configuration NetAdapterRdma_EnableRdmaSettings_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterRdma EnableRdmaSettings { Name = 'SMB1_1' Enabled = $true } } } ``` -------------------------------- ### Add Firewall Rule to Existing Group Source: https://github.com/dsccommunity/networkingdsc/wiki/Firewall Configures a new firewall rule and assigns it to an existing firewall rule group. This example shows how to add 'MyFirewallRule1' to 'My Firewall Rule Group'. ```powershell Configuration Firewall_AddFirewallRuleToExistingGroup_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { Firewall AddFirewallRuleToExistingGroup { Name = 'MyFirewallRule' DisplayName = 'My Firewall Rule' Group = 'My Firewall Rule Group' } Firewall Firewall1 { Name = 'MyFirewallRule1' DisplayName = 'My Firewall Rule' Group = 'My Firewall Rule Group' Ensure = 'Present' Enabled = 'True' Profile = ('Domain', 'Private') } } } ``` -------------------------------- ### Enable Network Adapter Source: https://github.com/dsccommunity/networkingdsc/wiki/NetAdapterState This configuration enables the network adapter named Ethernet. ```APIDOC ## NetAdapterState EnableEthernet ### Description This resource is used to enable or disable a network adapter. ### Parameters #### Path Parameters - **Name** (String) - Required - Specifies the name of network adapter. #### Query Parameters - **State** (String) - Required - Specifies the desired state of the network adapter. Allowed Values: `Enabled`, `Disabled` ### Request Example ```powershell Configuration NetAdapterState_Enable_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { NetAdapterState EnableEthernet { Name = 'Ethernet' State = 'Enabled' } } } ``` ``` -------------------------------- ### Configure Proxy Settings with Auto Configuration Script Source: https://github.com/dsccommunity/networkingdsc/wiki/ProxySettings This configuration sets the proxy settings to use an automatic configuration script. Provide the URL to the WPAD script. Ensure auto-detection and manual proxy are disabled. ```powershell Configuration ProxySettings_AutoConfigurationProxy_Config { Import-DSCResource -ModuleName NetworkingDsc Node localhost { ProxySettings AutoConfigurationProxy { Target = 'LocalMachine' Ensure = 'Present' EnableAutoDetection = $false EnableAutoConfiguration = $true EnableManualProxy = $false AutoConfigURL = 'http://wpad.contoso.com/wpad.dat' } } } ```