How do you run a Powershell script from inside a GoAnywhere?

Looking for an example project to get you started?
1 post Page 1 of 1

Support_Julie

User avatar
Support Specialist
Posts: 87
Joined: Thu Mar 05, 2009 3:49 pm
Location: Ashland, NE USA

Post by Support_Julie » Fri Jan 18, 2013 3:32 pm
Question:

How do you run a Powershell script from inside a GoAnywhere Director (Windows install)?

Answer:

Powershell seems to work a little bit differently than other executables. It was hanging because powershell was expecting some kind of input before running the script. So to get it working, we created an empty text file and used that as the ‘Input File’ on the advanced tab. Even though there is nothing in the file, it will complete the powershell script as expected this way.
Code: Select all
<project name="Powershell" mainModule="Main" version="2.0">

	<module name="Main">

		<exec label="Execute Powershell Script with Parameters" executable="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" workingDir="C:\Windows\System32\WindowsPowerShell\v1.0" inputFile="C:\Linoma\empty.txt" version="1.0">
			<arg value="-File" />
			<arg value="c:\Linoma\test files\hello.ps1" />
		</exec>

	</module>

	<description>How to Execute a Powershell Script</description>
</project>
One thing to note, we only needed the –File argument but you may need additional arguments depending on your system’s setup. Some people have needed the –Noninteractive flag or use –ExecutionPolicy Bypass. Please refer to your Powershell manual for additional information.
Julie Rosenbaum
Sr Support Analyst
e. goanywhere.support@helpsystems.com
p. 1.800.949.4696
w. HelpSystems.com
1 post Page 1 of 1