PowerShellComponent

Hi Team,

Need some help with respect to PowerShellComponent

I have a requirement to return the TemporaryAccessPass by executing the below PowerShell and send it over mail.

Is it possible to get the output of PowerShell(need to get TemporaryAccessPass) and store it in a variable using PowerShellComponent ?

Please share sample script if you have any.

# Create a Temporary Access Pass for a user $properties = @{} $properties.isUsableOnce = $True $properties.startDateTime = '2022-05-23 06:00:00' $propertiesJSON = $properties | ConvertTo-Json New-MgUserAuthenticationTemporaryAccessPassMethod -UserId user2@contoso.com -BodyParameter $propertiesJSON Id CreatedDateTime IsUsable IsUsableOnce LifetimeInMinutes MethodUsabilityReason StartDateTime TemporaryAccessPass -- --------------- -------- ------------ ----------------- --------------------- ------------- ------------------- 00aa00aa-bb11-cc22-dd33-44ee44ee44ee 5/22/2022 11:19:17 PM False True 60 NotYetValid 23/05/2022 6:00:00 AM TAPRocks!

Parents
  • Hi,

    A long time ago, in a galaxy far far away ........ I needed to get the return value from some PowerShell ........... we're talking V5 or V6 I don't recall ...... anyway there is a 'free' output variable as follows:

    "&OUT(OutValue_0)&"

    Note: You don't need to name this variable in the PoSh step parameters ..... it's just there as an output parameter.

    That will contain the output of your PoSh component.  Depending on what you are returning, you 'may' need to deserialize the returned value to get to the data you want.

    But this should get you started.

    HTH, Barry.

Reply
  • Hi,

    A long time ago, in a galaxy far far away ........ I needed to get the return value from some PowerShell ........... we're talking V5 or V6 I don't recall ...... anyway there is a 'free' output variable as follows:

    "&OUT(OutValue_0)&"

    Note: You don't need to name this variable in the PoSh step parameters ..... it's just there as an output parameter.

    That will contain the output of your PoSh component.  Depending on what you are returning, you 'may' need to deserialize the returned value to get to the data you want.

    But this should get you started.

    HTH, Barry.

Children
No Data