title: Powershell scripts will not work with Jenkins plugin on Windows
body: <p>I'm writing some pretty simple scripts in Powershell 32-bit and they are working fine.</p>
  
  <p>For instance, I want to open internet explorer to a webpage and start typing in keys. The following code works fine when I run it in powershell ISE.</p>
  
  <pre><code>Add-Type –AssemblyName System.Windows.Forms
  $url = "http://WebAddress"
  $ie = New-Object -com "InternetExplorer.Application"
  $ie.Navigate($url)
  
  sleep 30
  
  [System.Windows.Forms.SendKeys]::SendWait("{2}{tab}{H}{E}{L}{L}{O}")
  </code></pre>
  
  <p>I have downloaded a <a href="https://wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin" rel="nofollow">Windows PowerShell plugin</a> and have executed the same code through it and received the following errors:</p>
  
  <pre><code>Building on master in workspace C:\Program Files\Jenkins\workspace\Jenkins Test
  [Jenkins Test] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "&amp; 'C:\WINDOWS\TEMP\hudson257018662776252417.ps1'"
  New-Object : Creating an instance of the COM component with CLSID {0002DF01-000
  0-0000-C000-000000000046} from the IClassFactory failed due to the following er
  ror: 80004005.
  At C:\WINDOWS\TEMP\hudson257018662776252417.ps1:4 char:17
  + $ie = New-Object &lt;&lt;&lt;&lt;  -com "InternetExplorer.Application"
      + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMExcept 
     ion
      + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Comman 
     ds.NewObjectCommand
  
  You cannot call a method on a null-valued expression.
  At C:\WINDOWS\TEMP\hudson257018662776252417.ps1:5 char:13
  + $ie.Navigate &lt;&lt;&lt;&lt; ($url)
      + CategoryInfo          : InvalidOperation: (Navigate:String) [], RuntimeE 
     xception
      + FullyQualifiedErrorId : InvokeMethodOnNull
  
  
  Exception calling "SendWait" with "1" argument(s): "Access is denied"
  At C:\WINDOWS\TEMP\hudson257018662776252417.ps1:9 char:42
  + [System.Windows.Forms.SendKeys]::SendWait &lt;&lt;&lt;&lt; ("{2}{tab}{H}{E}{L}{L}{O}")
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : DotNetMethodException
  </code></pre>
  
  <p>Is there a reason why my code will not work through Jenkins like it does in Powershell? I tried some simple echo scripts which worked fine, but any more complex and it throws an error.</p>