Last active
August 29, 2015 14:14
-
-
Save carlessanagustin/724b482de97795e880f6 to your computer and use it in GitHub Desktop.
(PowerShell) Request static IP configuration and place it into a text file
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
## An A-Z Index of Windows PowerShell 2.0 commands: http://ss64.com/ps/ | |
do { | |
$ip = Read-Host "Enter IP address" | |
$mask = Read-Host "Enter mask" | |
$gw = Read-Host "Enter default gateway" | |
Write-Host 'Is this information correct? IP $ip MASK $mask GW $gw' | |
$confirm = Read-Host "yes/no" | |
}while ($confirm -notlike "yes") | |
$text = 'sudo ifconfig eth0 $ip netmask $mask`n | |
sudo route add default gw $gw eth0`n | |
nameserver 8.8.8.8`n | |
nameserver 8.8.4.4`n' | |
## https://technet.microsoft.com/en-us/library/hh849859.aspx | |
Add-Content -Path C:\Users\UserName\Desktop\test.txt -Value $text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment