MOVEit Top Tips - MOVEit Managed File Transfer

MOVEit Automation Tips: Using Powershell for custom scripts

Written by Admin | Mar 11, 2020 1:16:00 PM

MOVEit Automation users can use Powershell for custom scripts. This is a relatively new feature and is more effective than previous workarounds administrators had in place. If, for example, you are still either writing scripts in VB, or using the Command Line script to call Powershell and passing the script name as a parameter – we’d suggest adopting this approach instead. Using the latter method has drawbacks because you cannot access any of MOVEit’s specific functions that are so useful (eg: renaming a file during the transfer).

Create a Powershell script

To create a Powershell script you have to use the WebAdmin interface instead (on a side note, it’s worth getting into the habit of using the webadmin interface to make use of other features like the Amazon S3 connectors – and please note that Ipswitch intend to retire the old VB Admin interface, so no new functionality is being added).

To add a new Powershell script, go to the Scripts tab and press the ‘Add Script’ button. You can then provide a name, select Powershell as the language, and start typing. You don’t have to complete the script there and then – just enter some text as a place holder until you have time to work on it. If you have a script already, you can import it at this point.

It is worth spending some time looking at how Powershell scripts need to be written, because it can be a little confusing. To simplify things, use the available templates to understand how to use the functions and subroutines described in the documentation (for example, in your scripts handle them as methods, not functions!).

Here is my sample script after a little editing:

 

Even though you cannot manage the script in the older VB admin interface, you can still see it and edit the definition too. Unfortunately though, if you attempt to edit the script this way, you will lose formatting (line feeds) and end up with a .vbs file.

You can, of course, still use the VB Admin interface to run the task and view its progress.

 

 

 

 

 

 

If you have purchased the MOVEit Automation API, you can also use the Powershell custom scripts to call the REST API. This would allow you to execute all of the available API functions from within a task. For example, you could schedule a task to automatically disable the scheduler and stop the service when all tasks currently executing have been completed.

If you are a MOVEit Automation user with a support contract and you would like help creating a powershell script, please raise a support ticket. One of our technical consultants will be in contact.