title: Checking whether windows system is idle and running background script
body: <p>This may be a weird question.
  But i need to do this .</p>
  
  <p>Actually we are trying to execute UItests as part of Continuous integration purpose. 
  Problem : When the testagent machine is idle for sometime, desktop gets locked and tests starts failing.
  We cannot remove security feature which prevents system from getting locked. IT is a violation of our company policy.</p>
  
  <p>Our Solution
  We will check if system (windows 8 / 2008) is idle at regular intervals like 3 mins or so,and if it is idle, then we will trigger a vbs script to perform clicking of num key. 
  And after 3 minutes again we check if system is idle and decide.
  Whole objective is to prevent system from getting locked.</p>
  
  <p>You may wonder whether this is also a security violation. When security aduit happens, they will see whether any windows feature is disbled and not whether we are running scripts in background to keep system active.</p>
  
  <p>So any one knows how to check via batch file / C# to achieve the above scenario.
  Anyother working suggestion also welcomed.
  Helps appreciated.</p>
  
  <p>Thanks,
  VVP</p>