title: Automating my job in .bat commands
body: <p>This set of commands does not run through cleanly. It renames properly but doesn't join the domain or add the user to the localgroup administrators.</p>
  
  <pre><code>@echo off
  SET /P compName=Name of the computer:%=%
  SET /P duName=Computer User:%=%
  SET /P adminUserName=Admin UserName:%=%
  SET /P adminPassword=Admin Password:%=%
  echo If the Above information was entered incorrectly or is incorrect please exit this application now.
  PAUSE
  CLS
  
  echo Renaming the computer %compName%.
  wmic COMPUTERSYSTEM WHERE Name="%ComputerName%" CALL Rename Name="%compName%" Password=null UserName=null
  
  PING 1.1.1.1 -n 1 -w 3000 &gt; nul
  
  echo Error Level: %errorlevel%
  echo Joining the computer to the Doamin.net Domain.
  wmic COMPUTERSYSTEM WHERE Name="%COMPUTERNAME%" CALL JoinDomainOrWorkgroup FJoinOptions=1 Name="Domain.net" UserName="%adminUserName%" Password="%adminPassword%"
  echo Error Level: %errorlevel%
  
  PING 1.1.1.1 -n 1 -w 3000 &gt; nul
  
  echo Adding %duName% to the Administrator's group.
  net LOCALGROUP Administrators /ADD %duName%
  echo Error Level: %errorlevel%
  
  PING 1.1.1.1 -n 1 -w 3000 &gt; nul
  
  echo Restarting computer...
  Shutdown /R /c "Restarting computer and applying changes."
  </code></pre>
  
  <p>But if I replace the Ping commands with PAUSE it does go cleanly through. Problem is that I want it automated and I don't want to use a different coding language. I think the problem lies with the WMIC already being used for the rename and the PAUSE releases it and then it get's reinitialized again for the domain then of course the add to administrators group fails since it's always going to be a domain account, but again I don't know for sure. Any insight would be appreciated!</p>