title: Shutdown/restart command using a variable in powershell
body: <p>I am working on a GUI reboot modul in a tool of mine.
  I want to use the command prompt "shutdown" command line for this.
  Its purpose is to replace the "shutdown -i" on multiple servers and then I can ping them automatically to check if the reboot was succesfull.</p>
  
  <p>In CMD the command line looks like this: </p>
  
  <pre><code>shutdown /r /t 30 /m \\server /c "reboot reason"
  </code></pre>
  
  <p>In my script I will ask for the:</p>
  
  <ul>
  <li>reason = $comment</li>
  <li>time = $time (the value and also in a checkbox if it is required or not)</li>
  <li>server name = $server</li>
  </ul>
  
  <p>I will test with a few "if"s the time option, is it checked or not and that the reboot reason is not empty and then add all of them to a variable:</p>
  
  <pre><code>$reboot = "/r /t " + $time + "/m \\" + $server + "/c " + $comment
  </code></pre>
  
  <p>and then use the variable in the command in powershell:</p>
  
  <pre><code>&amp; shutdown $reboot
  </code></pre>
  
  <p>My question is will this work? Did anyone use it like this? Or there is a better way to do it?
  I can't test it for a few days because I don't have any servers right now on the network that I can reboot feely.</p>