Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. @echo off
  2. SET netdomPath=c:\windows\system32
  3. SET /P newName=please enter pcname:
  4. SET domain=domain.net
  5. CALL BATCH.BAT %passwd%
  6. CALL BATCH.BAT %adminUser%
  7. ECHO passwd set
  8. SET sourcePath=\\fileshare\folder\
  9. ECHO set all variables
  10. PAUSE
  11.  
  12. ::If necessary, copy netdom to the local machine
  13. IF EXIST c:\windows\system32\netdom.exe goto join
  14. COPY %sourcePath%netdom.exe %netdomPath%
  15. COPY %sourcePath%dsquery.exe %netdomPath%
  16. COPY %sourcePath%dsrm.exe %netdomPath%
  17. echo SOMETHING WENT WRONG. These files should be present!
  18. pause
  19.  
  20. :Join
  21. ::Join PC to the domain
  22. ECHO Enter JOIN
  23. PAUSE
  24. NETDOM JOIN %computerName% /d:%domain% /UD:%adminUser% /PD:%passwd%
  25. ECHO netdom command
  26. PAUSE
  27.  
  28. ::Change the computer name
  29. NETDOM RENAMECOMPUTER %computerName% /NewName:%newName% /UD:%adminUser% /PD:%passwd% /force
  30. ECHO netdom2
  31. PAUSE
  32.  
  33. ECHO Press any key to restart
  34. PAUSE
  35. SHUTDOWN -r -t 0
  36.  
  37.  
  38.  
  39.  
  40. @echo off
  41. SET netdomPath=c:\windows\system32
  42. SET domain=domain.net
  43. CALL BATCH.BAT %passwd%
  44. CALL BATCH.BAT %adminUser%
  45. SET sourcePath=\\fileshare\folder\
  46.  
  47. ::If necessary, copy netdom to the local machine
  48. IF EXIST c:\windows\system32\netdom.exe goto join
  49. COPY %sourcePath%netdom.exe %netdomPath%
  50. COPY %sourcePath%dsquery.exe %netdomPath%
  51. COPY %sourcePath%dsrm.exe %netdomPath%
  52.  
  53. :Join
  54. ::Join PC to the domain
  55. PAUSE
  56. NETDOM JOIN %computerName% /d:%domain% /UD:%adminUser% /PD:%passwd%
  57.  
  58. SHUTDOWN -r -t 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement