2014-04-01 11:16 AM - edited 2015-12-18 12:24 AM
SC Environment: All servers are Microsoft Windows Server 2008 R2
Is there a document that describes how to call a powershell script from a SC config to do some pre and post actions ? (for example POST_NTAP_DATA_TRANSFER_CMD01=)
I want to call a powershell script and pass it several parameters. Those parameters are SC variables and my own variables.
2014-04-02 04:59 AM
Snap Creator simply passes commands onto the systems command interpreter, so you will need to figure out a command string that you can call from Windows to execute the PowerShell command.
I suspect that you will need to call powershell.exe then add && to tell Snap Creator to run the next command within PowerShell (so the command is passed as a single line)
Here is a similar example that is calling a Teamcenter shell instead of a PowerShell...shell:
C:\PROGRA~1\Siemens\TEAMCE~1\tc_menu\TcEng_config1.bat && backup_modes.exe -u=infodba -p=infodba -g=dba -m=normal
Once the command works with your variables, you can add in the Snap Creator variables and include the command into Snap Creator's PRE and POST commands.
You need to be sure to add any commands that you are calling to the allowed_commands.config file on the Agent. You also must restart the Agent to get the allowed_commands to be accepted.
In the example command above I have to add the following to allowed_commands.config:
Snap Creator knows these are two different commands, so they must both be added.
Since backup_modes.exe isn't fully qualified when we call it, it doesn't have to be fully qualified in the allowed_commands.config file either.
There is a video on adding allowed commands here: https://www.youtube.com/watch?v=niZYjI710_Q
I also have a video coming on using the APP_QUIESCE and APP_UNQUIESCE commands in Snap Creator. That video is recorded, but need to be edited and reviewed.
The concept should be similar to what you are trying to do.
Hope this helps,
2014-04-03 05:55 AM
I will try this in our new installation (SC4.1P1). I know this did not work well in SC 3.6.
I will get back to you when I have time to test it.