homotechsual / HaloAPI

PowerShell module for the Halo Service Solutions series of software products.
MIT License
48 stars 38 forks source link

How to use PS Module in Halo Actions #23

Closed FarazUSL closed 1 year ago

FarazUSL commented 1 year ago

Wondering if you can offer some guidance on “recommended way” on running the Module in Halo PowerShell actions? 😊 Trying to pass a ticket in to grab information from and then do some write backs, asset updates etc. from the information in that ticket.

The whole Ps5 and needing to run in it PS7 is getting a little confusing to pass parameters ticket ID etc. into the script (seems to be the only piece not working for us right now...i.e. hardcoding a ticket ID works)

Have been able to get some parts working with start process in ps5 with pwsh and passing a script block. image

$ps7Stprc = Start-Process pwsh -ArgumentList "-Command &{ $scriptBlockForPWSH }" -Wait -RedirectStandardOutput $logMessage -RedirectStandardError $stdErrLog -PassThru

I see Halo is adding “use PS 7 check in “v2.102.1” but we are on stable i.e. ver. 2.98.12 and need to be...so have to wait for that lol :)

Currently our config is using the option for running via Halo integrator.

FarazUSL commented 1 year ago

Found the syntax for this....adding the $TicketID" in the command as below passes the variable into the code to allow it be properly used.

$ps7Stprc = Start-Process pwsh -ArgumentList "-Command & {$scriptBlockForPWSH} $TicketID"