Using Splatting Hashtable for to set parameters and works well.
I am passing to a function as New-ADUser @param
, the values that are set in splatting will be created in Active Directoy . However, my script will be running somewhere else. The Json file will be manipulated by the user.
How I can pass to this New-ADUser @param
function the Json file instead Splatting table.
Thanks for your help.
The answer by @mklement0 is great and explains everything. i am stuck in the ps5 world currently, so i have to resort to skipping the -ashashtable option. I thought I'd show a little example of how I do it. This is just a more terse version of what @mklement0 has.
I currently use a oneliner for the conversion like the sql example below:
and settings.json looks something like...
i have other settings in the file that do i don't need to pass as args, so i don't need to convert the entire file, just this one property for splatting.
i thought about creating a module for this since i use it a bit for various things, but i this project which looks like it would do the trick in that case.