I am writing a script that operates on multiple pairs of clustered servers and am seeking help on how to author the parameters to the script. Each cluster has 2 nodes, and each node has a name, IP, and role(e.g., FileServer, Webserver, etc.). What’s the best way to structure the command line parameters so that someone can pass in this information in a sensible way?
I could do something like this:
Param(
$PrimaryNodeNames,
$PrimaryNodeIPs
$PrimaryNodeRoles
$SecondaryNodeNames
$SecondaryNodeIPs
)
And then I could call
Myscript.ps1 -PrimaryNodeNames ("WebserverPrimary", "FileServerPrimary") -PrimaryNodeIPs ("192.168.1.1", "192.168.1.2") -PrimaryNodeRoles("Webserver", "FileServer") -SecondaryNodeNames ("WebserverBackup", "FileServerBackup") -SecondaryNodeIPs ("192.168.1.3", "192.168.1.4")
But this seems odd and confusing to split the information about each clustered node across multiple parameters like this. This will be especially hard as the set of clusters gets longer. Is there a better way to group together all information for each clustered node in a way that makes more sense?