Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # script32.ps1
- $Answer = Read-Host "Enter mode (Auto/Manual)"
- switch ($Answer) {
- "Auto" {
- Remove-NetRoute -InterfaceAlias "Ethernet" -Confirm:$false
- Set-NetIPInterface -InterfaceAlias "Ethernet" -Dhcp Enabled
- Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses
- }
- "Manual" {
- New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.1.10 -DefaultGateway 192.168.1.1 -PrefixLength 24
- Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 8.8.8.8
- }
- Default {
- Write-Host "Wrong input!"
- }
- }
- Pause
Add Comment
Please, Sign In to add comment