批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[转贴] VBS脚本把计算机加入到域

  1. '* Start Script
  2. '***********************
  3. Const JOIN_DOMAIN = 1
  4. Const ACCT_CREATE = 2
  5. Const ACCT_DELETE = 4
  6. Const WIN9X_UPGRADE = 16
  7. Const DOMAIN_JOIN_IF_JOINED = 32
  8. Const JOIN_UNSECURE = 64
  9. Const MACHINE_PASSWORD_PASSED = 128
  10. Const DEFERRED_SPN_SET = 256
  11. Const INSTALL_INVOCATION = 262144
  12. strDomain = "linson.com"
  13. 'domain需更改为自己域的名称               /*此行为描述所用*/
  14. strPassword = "456123"
  15. '有domain admins组权限的用户及密码       /*此行为描述所用*/
  16. strUser = "zhangxianxiao"                /*此行为描述所用*/
  17. Set objNetwork = CreateObject("WScript.Network")
  18. strComputer = objNetwork.ComputerName
  19. Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
  20. strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
  21. strComputer & "'")
  22. ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
  23. strPassword, strDomain & "\" & strUser, NULL, _
  24. JOIN_DOMAIN + ACCT_CREATE)
  25. wscript.echo "命令己完成."
  26. wscript.echo "请重启你的电脑!"
  27. '*****************
  28. '* End Script
  29. '*****************
复制代码


http://freedom.blog.51cto.com/408938/83720

学习了……

TOP

返回列表