◆当blogは、Linuxサーバ構築する際の実際の設定手順を個人的メモとして記載しております。LinuC試験の役に立つ情報があるかも…?
既存しているローカルアカウントの設定を変更するサンプル作りました。
ファイル名:A1.ps1
# //変数格納//
$computer = $Env:ComputerName
$cdpath = (Get-Location).Path
# //text⇒CSV変換//
$csv = import-csv -path $cdpath\A.txt
# //ファイル情報の読込み//
foreach($strUser in $csv){
# //情報取得//
$user = $struser.user
$password = $struser.password
$description = $struser.description
# //初期化//
Clear-Host
# //説明文とパスワードの設定変更//
$objUser = [ADSI]"WinNT://$computer/$user"
$objUser.setpassword($password)
$objUser.description = $description
$objUser.SetInfo()
}
COMMENT