homotechsual / HaloAPI

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

Syntax for Remove-HaloTicketBatch #43

Closed machine-bit closed 2 months ago

machine-bit commented 2 months ago

I am struggling to get this working, as path of teh parameter -tickets I have tried every connotaion of array / object and it still fails stating "Remove-HaloTicketBatch requires an array of ticket ids to delete." Anyone used thsi recently? I have got round it using a foreach loop and the Remove-HaloTicket command, but I have a feeling it might be a bug

homotechsual commented 2 months ago

Yeah so that's broken. Sorry. It's got the wrong parameter type. You can fix it locally by changing the type in the Remove-HaloTicketBatch to Int64[] instead of array[]. I'll get it fixed tomorrow and we're overdue a release anyway!

homotechsual commented 2 months ago

oh, and change $Actions -is [Array] to $Tickets -is [Array] this one's a bad copypasta :-D

machine-bit commented 2 months ago

@homotechsual I did actually see that bit and wondered what it was doing, it all makes sense now. Thought it was me rather than the code :-)

homotechsual commented 2 months ago

Just released 1.21.0 which should fix this :-)

machine-bit commented 2 months ago

@homotechsual can lslightly further; Exception: Exception calling "ShouldProcess" with "2" argument(s): "A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Are you sure you want to perform this action?

Is this because Remove-HaloTicket needs the -confirm:$false passing?

homotechsual commented 2 months ago

Yeah, it would. We use ShouldProcess for confirmation in all the batch commandlets and all remove commandlets.

If you're doing noninteractive scripts you should always set $ConfirmPreference to None or High