ドメインに参加するスクリプト ~Windows PowerShell 編
??????????????????????? Active Directory ??????????????????????????????????
Windows PowerShell ????????????????????????
$JOIN_DOMAIN = 1 $ACCT_CREATE = 2 $ACCT_DELETE = 4 $WIN9X_UPGRADE = 16 $DOMAIN_JOIN_IF_JOINED = 32 $JOIN_UNSECURE = 64 $MACHINE_PASSWORD_PASSED = 128 $DEFERRED_SPN_SET = 256 $INSTALL_INVOCATION = 262144 $strDomain = "example" $strPassword = "P@ssw0rd" $strUser = "administrator" $ret = (get-WmiObject Win32_ComputerSystem).JoinDomainOrWorkGroup( $strDomain, $strPassword, $strDomain + "\" + $strUser, $null, $JOIN_DOMAIN + $ACCT_CREATE) if($ret.ReturnValue -eq 0){ shutdown /r /t 0 } else { $ret }
?????????? get-WmiObject ?1????????????????????????????? JoinDomainOrWorkGroup ???????????????????????????
????????? join.ps1 ??????????????Windows PowerShell ?? ./join.ps1 ??????????????????????????? $ret = ./join.ps1 ?????????????????????????????????????????????
???????????????????????????????????????????????????
????????????????????????·?????????????????