arongsoft 发表于 2018-9-2 11:13:33

Use PowerShell to Replace netdom Commands to Join the Domain

  Use PowerShell to Replace netdom Commands to Join the Domain
  使用Powershell替代netdom命令将计算机加入域
  本文摘自:http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/29/use-powershell-to-replace-netdom-commands-to-join-the-domain.aspx
  这里仅摘录部分信息,更详细请点击此链接
  Microsoft Scripting Guy, Ed Wilson, is here. Well this afternoon I am drinking something a bit different. I decided to make a cup of masala chai. (The word chai, or many of its variations, simply means tea in many languages. Therefore, to speak of chai tea is redundant.) Anyway, I decided to use Dajarling tea, brewed a little strong, and I added cloves, cardamom, a cinnamon stick, fresh ground pepper, and 1/3 cup of warm milk. Coupled with an Anzac biscuit, it was quite nice.
  AD, the reason that you cannot use your batch file (containing netdom commands) on Windows 7 is that by default Windows 7 does not contain the netdom command. You can add netdom to your computer running Windows 7 by installing the latest version of the Remote Server Administration Tools (RSAT). When it is installed, you still need to go to Programs and Features and turn on the tools you want to load. The RSAT tools are great, and that is where you gain access to the Active Directory module. But you should not load the RSAT only to access netdom, because you can do what you want to accomplish out of the box (assuming that your box is not Windows 7 Home edition that does not join domains).
  AD, your batch file contained at least three commands to rename the computer, join the domain, and to restart the machine. The two netdom commands and the shutdown command are shown here.
  netdom renamecomputer member /newname:member1.example.com /userd:administrator
  netdom add /d:reskita mywksta /ud:mydomain\admin /pd:password
  shutdown /r
  In Windows PowerShell 2.0, this is still three commands, but at least the commands are native to Windows 7. In addition, the Windows PowerShell command is easier to read, and they support prototyping. An example of using Windows PowerShell to add a computer to the domain, rename the computer, and reboot the machine is shown here.
  (Get-WmiObject win32_computersystem).rename("newname")
  add-computer -Credential iammred\administrator -DomainName iammred.net
  Restart-Computer

页: [1]
查看完整版本: Use PowerShell to Replace netdom Commands to Join the Domain