I’ve been struggling for the last days (and still haven’t solved it) to get the output of a Power Shell command.
The command name is “New-Team”, it’s used for creating Microsoft Teams groups, and it needs several parameters as -DisplayName, -Owner, -Description and -Visibility, all them as Strings.
I can get the output of running that command by specifying a variable in the “Output” section from the Invoke Power Shell activity. But, so far, only if a define it as a collection of generic Object type. Then, in the element 0 (as it only contains one element), I have this TeamsSettings object:
TeamSettings
{
AllowAddRemoveApps=true,
AllowChannelMentions=true,
AllowCreatePrivateChannels=true,
AllowUserEditMessages=true,
Archived=false,
Classification=null,
GiphyContentRating=moderate,
InternalId=“19:XJXxyaBYW3-yqtF31C5OzNWr8MqnpaE1@thr.tav2”,
…
}
The property I need to collect is InternalId, a mere String. I understand it should be straightforward to be able to choose the TeamSettings as the output type (a collection of it, to be more specific), but it’s not available, no matter what I attempt.
And then there’s starts my pain. I’m trying a number of tricks, mainly selecting different output types to see if there’s some that could be “compatible” with that format or who knows what; just mere trial and error.
So everytime I change that type, the input parameters get ERASED, no matter if the types involved there are all String, and are input parameters for the command that gets executed and have nothing to do with that output parameter.
So everytime I have to manually enter -DisplayName, -Owner, -Description and -Visibility again, which is a pain in the ass.
And, by the way, the documentation about how the activity works is so scarce that I can’t still not undersand what the “Input → Input” Textinput value is for. “A collection of PSObjects that are passed to the writer of the pipeline used to execute the command. Can be the output of another InvokePowerShell activity”, and you can only see this is you keep the mouse pointer on it. Is it really that difficult to provide proper documentation, with AT LEAST ONE EXAMPLE?