I need to fully automate the process that adds the machine to the domain; however, I am stuck on the last part. Am I able to pass a variable I declared earlier in the script to the DOS Command? Example Below:
set objWMIService = GetObject("winmgmts://" & Computer)
set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run"cmd.exe /C NETDOM ADD /d:Domain **Need to pass Variable Here (Computer Name)*** /ud:mydomain\admin /pd:password", 0, False
I already have the machine name declared previously in the program. If this isn't possible, I am able to have this WMI script create a batchfile on the file that will write the command as test and put the proper variable in it?