An example of encapsulating PowerShell scripts in batch files for use by the ESE Agent is provided below.
1. Create your PowerShell script.
For example, this script named "PowerShellTest.ps1" moves all files from C:\Folder1 to C:\Folder2.
Move-Item -Path C:\Folder1\* -Destination C:\Folder2
2. Create a batch file.
It should contain the following:
powershell.exe -executionpolicy Bypass -file <path to powershell file>
Example:
powershell.exe -executionpolicy Bypass -file .\PowerShellTest.ps1
Note: The path to the PowerShell file can be absolute or relative.
3. Save the batch file.
4. Configure the Script in the Agent.
Add the script to the Backup Scripts configuration in ESE (under Tools > Options and Settings), setting it to run before the backup or afterwards as desired.
Comments
0 comments
Please sign in to leave a comment.