aaronengels / DattoRMM

A PowerShell module that connects to the Datto RMM API
GNU General Public License v3.0
64 stars 23 forks source link

Quick job variables fix #13

Closed robgilbreath closed 3 years ago

robgilbreath commented 3 years ago

I was never able to get a hashtable that would properly set multiple variable values, so I added code to convert a simple hashtable, e.g. @{"bar"="baz";"qux"="quux"}, into an array that is compatible with Datto RMM API.

This should be considered a breaking change, as anyone who was calling this function with a variable hashtable in a successful way that I could not replicate would now need to alter their code.

I have tested this with zero, one, and two variables defined

There are a couple of other small changes that I made while working on this change that could be separated into a separate pull request if needed:

Set-ApiParameters

Set-DrmmDeviceQuickJob

aaronengels commented 3 years ago

Thanks, @robgilbreath, maybe we could create a separate function, or add it as an extra parameter?

robgilbreath commented 3 years ago

@aaronengels you are right - the better solution is extra parameter, which keeps it backward compatible. Please see the proposed changes that add a $VariableDefinitions parameter. I also dug around some more and figured out how to use the function as originally intended and added some documentation for slow-uptake users like me.

KelvinTegelaar commented 3 years ago

Tested, looks stable. Merging to master. :)