I wrote a module to deal with permissions that need to be set for an application when it is being installed.
This module does the following things:
1. adds permissions
2. removes permissions
3. has specific functions to call specific permission adds.
With that in mind I struggled with how to utilize my new Powershell Module. Release management has this notion of Actions and Tools.
I discovered by trial and error that tools are copied to the machine and you can attach a script to the tool. So what I’m going to do now is show you the steps I took to get to the end result.
Now in the tool I can add my script:
Now since I have my tool in place I can now add an action:
In my action I can now call my function that is in the tool:
The tricky part is figuring out the right way to put the commandline parameters in.
The best way I’ve found to model the usage of your scripts is to go to the Powershell prompt and launch exactly the same way that Release management does.
After much trial and error and gnashing of teeth I found that declaring the variables first before calling the invoke command seemed to work the best.
I kept plugging along till I found the command in the Action to work as I wished it to:
$p = '__path__' ; $u = '__username__'; invoke-command { import-module .\myModule-ntfs.psm1; Add-ServicePermissions -username $u -path $p }
Now that I have my Action built I can call the action from my Release Template and give it the two params I provided in the script sample above:
UserName
Path
Now I get the behavior I want and the automation around scripted credential Adds.
Until then keep scripting.