title: How to reboot Jenkins node using shell in Groovy
body: <p>I am writing a Groovy script to perform an automatic reboot of Windows servers. In the script, I am first taking the nodes offline, then checking to see if there are any builds, if there aren't, then perform a restart. </p>
  
  <p>I wanted to use the safeRestart() method but it doesn't support the import statement I am using when looping through the nodes.  I have seen an execute() method which basically executes a shell line of code in groovy.  </p>
  
  <p>How would I execute a restart of the Windows computers using execute()?</p>