Created
April 1, 2016 11:23
-
-
Save usaturn/73a7482cd1d4c0f1025ad5b44a49aed4 to your computer and use it in GitHub Desktop.
Windows のローカルアカウントを作成する時に ID, コンピュータ名, パスワード の tsv ファイルを読ませて、コマンドを生成する
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
#!/usr/bin/gawk | |
/^.+/{ | |
LOCALUSER=$1 | |
HOSTNAME=$2 | |
PASSWORD=$3 | |
printf "powershell Start-Process powershell.exe -Verb runas\ | |
\nRename-Computer %s\ | |
\n(Get-WmiObject win32_TerminalServiceSetting -Namespace root\\cimv2\\TerminalServices).SetAllowTSConnections(1)\ | |
\nNET USER %s /add\nNET USER %s %s\ | |
\nwmic useraccount where \"Name='%s'\" set PasswordExpires=FALSE\ | |
\nnet localgroup \"Power Users\"%s /add\ | |
\nnet localgroup \"Remote Desktop Users\" %s /add\n\n", | |
HOSTNAME, LOCALUSER, LOCALUSER, PASSWORD, LOCALUSER, LOCALUSER, LOCALUSER | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment