Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- & {
- $wid=[System.Security.Principal.WindowsIdentity]::GetCurrent()
- $prp=new-object System.Security.Principal.WindowsPrincipal($wid)
- $adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator
- $IsAdmin=$prp.IsInRole($adm)
- if (-not $IsAdmin)
- {
- Write-Host -ForegroundColor Yellow "This needs to be run as administrator."
- Write-Host -ForegroundColor Yellow "Please open a new powershell as administrator, and try again."
- exit 2
- }
- else
- {
- $install = "acrylic-dns-proxy poshgit vagrant-manager"
- foreach ($program in @("git", "vagrant", "virtualbox", "vim")) {
- if (Get-Command -Name "${program}.exe" -ErrorAction SilentlyContinue) {
- Write-Host "Not installing ${program} bc it appears to already be installed."
- } else {
- $install = "${install} ${program}"
- }
- }
- foreach ($program in @("github", "googlechrome", "vscode")) {
- $doIt = Read-Host -Prompt "Shall I install the ${program} App? (y/N)"
- if ($doIt -match "^y") { $install = "${install} ${program}" }
- }
- Write-Host -ForegroundColor DarkMagenta "Point DNS settings at localhost? (Y/n)"
- $changeDns = Read-Host -Prompt "Choose yes if you don't know the answer."
- Write-Host ""
- Write-Host "Now is a good time to get a cup of coffee."
- Invoke-Expression -Command "choco.exe install -y $install"
- $hostsFile = "C:\Program Files (x86)\Acrylic DNS Proxy\AcrylicHosts.txt"
- '192.168.56.4 >dev' | Out-File -Encoding ASCII -Append $hostsFile
- if (-not ($changeDns -match "^(n|N)")) {
- $connection = netsh interface ip show interfaces |
- Where-Object {$_ -match " connected"} |
- Where-Object {(-not ($_ -match "Loopback")) -and (-not ($_ -match "VirtualBox"))} |
- Select-Object -First 1
- $connectionName = [regex]::Match($connection, "connected (.*)$").captures.groups[1].value
- netsh.exe interface ip set dns "${connectionName}" static 127.0.0.1
- Write-Host -ForegroundColor DarkYellow "Done."
- }
- Write-Host "Done. Woo hoo! Better restart your computer now."
- }
- }
Add Comment
Please, Sign In to add comment