IT Knowledge Base

~ Without sacrifice, there can be no victory ~

發佈日期:

如何利用PowerShell指令‧退出域名及重新加入域名(Re-join domain)

# Repair computer secure channel
Test-ComputerSecureChannel -Repair -Credential (Get-Credential) -Verbose
# Script to unjoin and rejoin domain
$computer = Get-WmiObject Win32_ComputerSystem
$computer.UnjoinDomainOrWorkGroup("admin_password", "admin_login", 0)
$computer.JoinDomainOrWorkGroup("domain_name", "admin_password", "admin_login", $null, 3)
Restart-Computer -Force

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *