Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

How To: Powershell on a Windows Agent

Usually the way I tell people to run powershell jobs to ensure output, and that they are running 64-bit versions of the cmd.exe and the powershell.exe is to drag those two exe files into the Agent/Bin directory. If you don't do this, then windows will force the 32-bit agent to only run 32-bit versions of powershell.exe EVEN IF you explicitly point to the 64-bit version in windows/system32 -- it'll still redirect to windows/SysWOW64 to use the 32-bit versions. This is a bug with the Windows operating system. Very often powershell scripts running in the wrong bit-version have errors in the script.

The way I do it is like this:

1.) Copy windows/system32/cmd.exe and windows/system32/powershell.exe into the Agent/Bin directory

2.) In the job definition:

command: /path/to/Agent/Bin/cmd.exe
parameter: /c "/path/to/Agent/Bin/powershell.exe --parameters /path/to/script"



This will ensure that the 64-bit versions are running by the agent. If you run it this way, the output will be printed to the output tab of the job. No need to write a batch script to call the powershell script.

A good way to verify the bit version the job is running inside is to open a task manager on the agent machine and look at the cmd.exe tasks. If the job becomes active and the new cmd.exe has nothing after it, it is 64-bit. If it has (32-bit) after, it is 32-bit.


Version history
Revision #:
1 of 1
Last update:
‎04-11-2014 07:01 AM
Updated by:
New Member


Found an easier way to do this and not have to put a command wrapper around powershell.

  • Create a directory that is not in the windows directory path i.e. c:\powershell64 or x:\powershell64 (whatever works for your particular system).
  • Copy the powershell executable from the /windows/system32/powershell directory to your new directory.

Your tidal job will now look like this:

  • command line:  <new directory>\powershell.exe
    • example: c:\powershell64\powershell64.exe
      • I added the 64 to make it more understandable
  • parameter line: your script or whatever else you are calling.


Enjoy!   C. Rufo