0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows Serverで自動ログオン(PowerShell)

Last updated at Posted at 2024-09-13

経緯

  • ParallelsなりHyper-VでWindows Server検証環境を動かすときに毎回Ctrl Alt Delでログインするのがめんどくさい。

image.png

2025年追記

  • Ctrl + Alt + Delキャンセルのコマンド追記しました。
# レジストリパスの定義
$WinlogonPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$PoliciesPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"

# 自動ログイン用の設定値
$DefaultUserName = "Administrator"  # 自動ログインするユーザー名
$DefaultPassword = "YourPasswordHere"  # ユーザーのパスワード
$AutoAdminLogon = "1"  # 自動ログインを有効化

# Ctrl+Alt+Del不要の設定値
$DisableCAD = 1  # 1にするとCtrl+Alt+Delが不要になる

# 自動ログインの設定
Set-ItemProperty -Path $WinlogonPath -Name "DefaultUserName" -Value $DefaultUserName
Set-ItemProperty -Path $WinlogonPath -Name "DefaultPassword" -Value $DefaultPassword
Set-ItemProperty -Path $WinlogonPath -Name "AutoAdminLogon" -Value $AutoAdminLogon

# Ctrl+Alt+Del不要の設定
Set-ItemProperty -Path $PoliciesPath -Name "DisableCAD" -Value $DisableCAD

# 設定完了メッセージ
Write-Host "自動ログインとCtrl+Alt+Del不要の設定が完了しました。再起動してください。"

ポエム

  • ParallelsのVMは再起動が3秒と爆速だったり、スナップショットが秀逸なので、自動ログインにより気軽に検証ができます。
  • 本番環境ではもちろんパスワードを設定しましょう。
  • Parallels Toolsを入れるとMacのTouchIDとの連携もできるようです。親切だなあ。

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?