Skip to content

Instantly share code, notes, and snippets.

@shinyaa31
Created July 15, 2017 16:24
Show Gist options
  • Save shinyaa31/7fcb331285bc62ad6b872ae87359f3de to your computer and use it in GitHub Desktop.
Save shinyaa31/7fcb331285bc62ad6b872ae87359f3de to your computer and use it in GitHub Desktop.
Windows環境の初期設定諸々を行うPowerShellスクリプト。
#########################################################################
## OS環境設定Powershellスクリプト
## 第1引数:コンピューター名
## 第2引数:AWSデフォルトリージョン
##
## ※実行前に以下コマンドを実行してスクリプトを実行出来るようにしておく事
## Set-ExecutionPolicy RemoteSigned
#########################################################################
Write-Host "** ComputerName:" $args[0]
Write-Host "** Default Region:" $args[1]
## コンピュータ名の変更(強制)
Rename-Computer -NewName $args[0] -Force
## AWSデフォルトリージョンの設定
Set-DefaultAWSRegion $args[1]
## タイムゾーンを変更
tzutil.exe /s "Tokyo Standard Time"
## フォルダオプション(拡張子を表示する)
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -name "HideFileExt" -Value 0
## フォルダオプション(隠しファイル、隠しフォルダ、隠しドライブを表示する)
Set-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -name "Hidden" -Value 1
## Windows ファイアウォールの無効化
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
## make Directory for tools
mkdir C:\tools
## nkf & gzipの環境変数設定
$path = [Environment]::GetEnvironmentVariable('PATH', 'Machine')
$path += ";" + "C:\tools\nkf" + ";" + "C:\tools\gzip"
[Environment]::SetEnvironmentVariable('PATH', $path, 'Machine')
## Firefox Download & Silent Install
## from https://ftp.mozilla.org/pub/firefox/releases/52.0/win64/ja/
Invoke-WebRequest -Uri "https://ftp.mozilla.org/pub/firefox/releases/54.0/win64/ja/Firefox%20Setup%2054.0.exe" -OutFile C:\tools\firefox.exe
C:\tools\firefox.exe -ms
## Install Chocolatey
# https://chocolatey.org/install#install-with-powershellexe
# Don't forget to ensure ExecutionPolicy above
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
## Install Git by Chocolatey
## choco install -y --force git
choco install -y git
## Install Python3.x by Chocolatey
choco install -y python3
## Install curl by Chocolatey
choco install -y curl
## 1分待機
Start-Sleep -Seconds 60
## OS再起動
Restart-Computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment