I have a long and quite big PS5 powershell script with several parameters, defined in the param() section at the beginning of the script file. These params are strings and hashtables, including hostnames, ip addresses, domains etc.
This script runs perfectly fine in my environment, but now it should also run in a second environment where all of the parameters are different.
So without changing all of the script commands, I would want to define a second param section with different values, and provide a "switch"-variable on top of the script, something like:
param1(
... my params1 ...)
param2(
... my params2 ... )
string configToUse = "param1"
I stumbled upon powershell parameter sets, but I guess this is not what I am looking for. Also I used some node definition files (.psd1) in the past, but I want to keep everything in one file which shall just be executed by double-click without necessity of passing -param1 or -param2 on the command line.
Can someone please point me into the right direction?
thanks!