Batch add Domains

Source: Internet
Author: User

Batch add Domains


Scripts are available in the Microsoft website Script Center.
According to your requirements, you can first create a DHCP server, specify the client DNS to DC. Then you can share the script so that you can run it yourself. The script is as follows:
Const join_domain = 1
Const acct_create = 2
Const acct_delete = 4
Const win9x_upgrade = 16
Const domain_join_if_joined = 32
Const join_unsecure = 64
Const machine_password_passed = 128
Const deferred_spn_set = 256
Constinstall_invocation = 262144
Strdomain = "Domain"
Strpassword = "password"
Struser = "user"
Set objnetwork = Createobject ("wscript. Network ")
Strcomputer = objnetwork. computername
Set objcomputer = GetObject ("winmgmts: {impersonationlevel = impersonate }! \\"&_
Strcomputer & "\ Root \ cimv2: win32_computersystem.name = '"&_
Strcomputer &"'")
Returnvalue = objcomputer. joindomainorworkgroup (strdomain ,_
Strpassword ,_
Strdomain & "\" & struser ,_
Null ,_
Join_domain + acct_create)
Wscript. Echo "the computer has been added to the domain! Press OK to restart the computer! "
Set Ws = wscript. Createobject ("wscript. Shell ")
WS. Run "shutdown-r-t 0", 0

----- The red mark indicates your actual domain name, user name, and password. (before running the script, make sure that DNS resolution is normal.
----- It is not recommended that you run the script by yourself. This script saves some administrator operations. The script will leak account information and disable it when used up.

This article is from the "hongbifu" blog, please be sure to keep this source http://flambee.blog.51cto.com/112166/1572057

Batch add Domains

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.