I'm having some issues with Remove-PWApplicationActions. It deletes actions other than specified and there appears to either be an action defined it is unaware of, or it is accidentally creating a wrong action.
I created a MicroStation application that has 2 open actions (MicroStation and MicroStation Connect), then 1 each of View, Markup & Print
If I run the command to delete all actions and all programs I get this:
Remove-PWApplicationActions -Applications 'MicroStation' -Programs 'All' -ActionTypes 'All' -Global WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'open' with program 'Microstation'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'open' with program 'MicroStation Connect'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type '' with program 'MicroStation'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'redline' with program 'MicroStation Connect'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'print' with program 'MicroStation'. True
You'll see there is an extra entry with action type '' for program MicroStation. This will cause some problems down the line. also action type redline is identified as MarkUp in the UI, it would be nice if they were consistent.
If I now try to delete just the Open actions
Remove-PWApplicationActions -Applications 'MicroStation' -Programs 'All' -ActionTypes 'Open' -Global WARNING: Unexpected action type GUID bab502f2-85b0-403c-bff5-c314e0783818 found. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'redline' with program 'MicroStation Connect'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'print' with program 'MicroStation'. True
It wants to delete all action types EXCEPT Open. (I tested with the -Delete set and it actually does delete all the other action types). I tested each of the individual action types and they all do the same, delete the other action types instead.
Specifying a Program name also seems to to do the opposite, delete all actions that do NOT have that program name
Remove-PWApplicationActions -Applications 'MicroStation' -Programs 'MicroStation Connect' -ActionTypes 'All' -Global WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'open' with program 'Microstation'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type '' with program 'MicroStation'. WARNING: Delete switch not specified. Would delete global action of application 'MicroStation' for action type 'print' with program 'MicroStation'.
Help issues:
The descriptions for Applications, programs and Action types imply they take an array in the help description but only list as accepting a <string> instead of <string[]>
-ActionTypes <string> Action types(s) to remove. -Applications <string> Application(s) to remove. -Programs <string> Program(s) to remove. Enter comma separated list of programs or 'all'.
ActionTypes should also list what action types it accepts.
And finally, would it be possible to add a Get-PWApplicationActions -Application 'appname' -Global -InputUsers that returns an array of objects with properties:
User should be Global or left out for that option
I was having similar issues. I ended up writing a new cmdlet to use.
We have made a number of improvements to Remove-PWApplicationActions in the latest release based on this post.
Mark Weisman | Bentley Systems