Set a network interfacres IPv4 address (hard coded 24bit mask) either dynamic or static including DNS settings.
Utils\Set-IPAddress.ps1
Set-IPAddress [[-AdapterName] <Object>] [[-BaseAddress] <Object>] [[-LastTriplet] <Object>]
[[-GateWayAddress] <Object>] [[-DNSServerAddress] <Object>] [-Dynamic]
The function uses built-in Windows 10 Methods to set IPv4 address properties of a network adapter.
#set Wi-Fi adpater's IP to 192.168.15.44
Set-IPAddress -LastTriplet 44
set Wi-Fi adpater's IP to dynamic
Set-IPAddress -Dynamic
Specifies the name of the network adapter to set the IP address for. Names can be retrieved using Get-NetAdapter. Defaults to Wi-Fi.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: Wi-Fi
Accept pipeline input: False
Accept wildcard characters: FalseFirst three triplets of the IP address to be set. Defaults to 192.168.15
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: 192.168.15
Accept pipeline input: False
Accept wildcard characters: FalseLast triplet of the IP address to be set.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseIPv4 address of the gateway to be set. Defaults to 192.168.15.1
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 192.168.15.1
Accept pipeline input: False
Accept wildcard characters: FalseIPv4 addresses of the primary and secondary DNS servers to be set. Defaults to ('1.1.1.1', '1.0.0.1').
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: ('1.1.1.1', '1.0.0.1')
Accept pipeline input: False
Accept wildcard characters: FalseSwitch parameter. If specified the adapters IP settins are set to automatic w/o static DNS servers.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False