<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[gOxiA=苏繁=SuFan Blog]]></title> 
<link>https://maytide.net/index.php</link> 
<description><![CDATA[gOxiA,苏繁,sufan,Microsoft MVP]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[gOxiA=苏繁=SuFan Blog]]></copyright>
<item>
<link>https://maytide.net/read.php/855.htm</link>
<title><![CDATA[将计算机加入到域中]]></title> 
<author>gOxiA &lt;sufan_cn@msn.com&gt;</author>
<category><![CDATA[PowerShell 和脚本]]></category>
<pubDate>Sat, 09 Jul 2005 01:03:41 +0000</pubDate> 
<guid>https://maytide.net/read.php/855.htm</guid> 
<description>
<![CDATA[ 
	<span><div><p><strong>说明</strong></p></div><div><p><br />将本地计算机加入到域中，然后在 Active Directory 中创建该计算机的帐户。 </p></div><div><p><strong><br />支持的平台</strong></p></div><table border="0" cellspacing="0" cellpadding="0" class="dataTable" id="EFAA"><thead></thead><tbody><tr class="record" valign="top"><td><p class="lastInCell"><strong>Windows Server 2003</strong></p></td><td style="border-right: #cccccc 1px solid"><p class="lastInCell"><strong>是</strong></p></td></tr><tr class="evenRecord" valign="top"><td><p class="lastInCell"><strong>Windows XP</strong></p></td><td style="border-right: #cccccc 1px solid"><p class="lastInCell"><strong>是</strong></p></td></tr><tr class="record" valign="top"><td><p class="lastInCell"><strong>Windows 2000</strong></p></td><td style="border-right: #cccccc 1px solid"><p class="lastInCell"><strong>否</strong></p></td></tr><tr class="evenRecord" valign="top"><td><p class="lastInCell"><strong>Windows NT 4.0</strong></p></td><td style="border-right: #cccccc 1px solid"><p class="lastInCell"><strong>否</strong></p></td></tr><tr class="record" valign="top"><td><p class="lastInCell"><strong>Windows 98</strong></p></td><td style="border-right: #cccccc 1px solid"><p class="lastInCell"><strong>否</strong></p></td></tr></tbody></table><div><p></p><p><br /><strong>脚本代码<br /><br /></strong>Const JOIN_DOMAIN = 1<br />Const ACCT_CREATE = 2<br />Const ACCT_DELETE = 4<br />Const WIN9X_UPGRADE = 16<br />Const DOMAIN_JOIN_IF_JOINED = 32<br />Const JOIN_UNSECURE = 64<br />Const MACHINE_PASSWORD_PASSED = 128<br />Const DEFERRED_SPN_SET = 256<br />Const INSTALL_INVOCATION = 262144<br /><br />strDomain = &quot;FABRIKAM&quot;<br />strPassword = &quot;ls4k5ywA&quot;<br />strUser = &quot;shenalan&quot;<br /><br />Set objNetwork = CreateObject(&quot;WScript.Network&quot;)<br />strComputer = objNetwork.ComputerName<br /><br />Set objComputer = GetObject(&quot;winmgmts:&#123; impersonationLevel=Impersonate &#125;!&#92;&#92;&quot; &amp; _<br />strComputer &amp; &quot;&#92;root&#92;cimv2:Win32_ComputerSystem.Name='&quot; &amp; _<br />strComputer &amp; &quot;'&quot;)<br /><br />ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _<br />strPassword, strDomain &amp; &quot;&#92;&quot; &amp; strUser, NULL, _<br />JOIN_DOMAIN + ACCT_CREATE)</p></div></span>
]]>
</description>
</item>
</channel>
</rss>