ユーザー作成

パスワード付きのユーザーを追加

  • 「password」というパスワード文字列を設定した新規ユーザー「test」を追加
    New-LocalUser -Name test -Password (ConvertTo-SecureString "password" -AsPlainText -Force)

「パスワードを無期限にする」を有効状態(チェックあり)に変更

Set-LocalUser -Name test -PasswordNeverExpires $true

グループにユーザーを追加

  • 「test-group」グループに「test」ユーザーを追加
    Add-LocalGroupMember -Group test-group -Member test

ユーザーの各種情報を表示

Get-LocalUser -Name [アカウント名] | Format-List -Property *

ユーザーのホームディレクトリを自動生成した上に test フォルダを作成

$userHomeDir = "C:\Users\$userName"
$securePassword = ConvertTo-SecureString [パスワード] -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $userName,$securePassword
Start-Process -FilePath cmd.exe -ArgumentList "/c mkdir $userHomeDir\test" -WindowStyle Hidden -Credential $cred -ErrorAction SilentlyContinue

ユーザープロファイル

ログイン

トラブルシューティング

初回ログイン時にホームディレクトリが作成される


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-02-08 (火) 08:45:46 (808d)