AD域迁移计算机脚本

子域间迁移计算机脚本:

If @LogonDomain = "BJ" Then Exit

FileCopy("\\192.168.10.1\sysvol\netdom.exe",@TempDir & "\netdom.exe",9)

;退出�f域 SH
$StringRemove = @TempDir & "\netdom.exe remove " & @ComputerName & " /Domain:SH.TEST.COM /UserD:Administrator /PasswordD:password"
$a = RunAsWait("Administrator","SH","password","",$StringRemove,"",@SW_HIDE)
;MsgBox(0,"",$a)

;加入新域 BJ
$StringJoin = @TempDir & "\netdom.exe join " & @ComputerName & " /Domain:BJ.TEST.COM /UserD:Administrator /PasswordD:password"
$b = RunAsWait("Administrator",@ComputerName,"password","",$StringJoin,"",@SW_HIDE)
;MsgBox(0,"",$b)

FileWrite("\\192.168.10.1\\SYSVOLUserComputer\" & @ComputerName & ".LOG",$a & "," & $b & @CRLF)

$YesNO = MsgBox(36,"尊敬的SH用�裟�好!","系�y已成功�⒕W域��SH�w移至BJ!" & @CRLF _
            & "�F在您的��X需要重��,��P�]您所有的文�n,然後�c�舸_定。" & @CRLF _
            & "重�⒅�後,��x�竦卿�到“BJ”,在新域中您的初始密�a�c您的工�相同," & @CRLF _
            & "�注意密�a中的“F”有可能是大��,也有可能是小��“f”" & @CRLF & @CRLF _
            & "�F在就重�㈦��X�幔�")
If $YesNO = 6 Then
    Shutdown(6)   ;��制重新��与��X
Else
    MsgBox(48,"�您稍後手�又�⒛�的��X","您�x�窳爽F在不重�㈦��X,�稍後手�又�⒛�的��X,以使新域生效。",5)
    Exit
EndIf
 

本文出自 “技�g成就�粝�” 博客,谢绝转载!

你可能感兴趣的:(迁移,ad)