January 1, 2012 at 12:00 am #5663MemberPoints: 0Rank: Member
by cre8tivspirit at 2013-03-14 10:44:38
Okay, here is the situation. I've created a GUI form that lists all the software I'm responsible for installing to developer workstations. I'm doing this so I can simply check the box on the software I want to install and it will call another script that already has the install steps coded for unattended installs (I want to take advantage of code already tested and functioning). I will simply have to modify the installation script to check the incoming parameter for true/false and install/ignore accordingly. Problem is, there are close to 30 different pieces of software and I'm not sure how to pass 30 different parameters from one script to another without some ridiculously long string. Is there a way to code these Boolean parameters in a stack or something that makes for neat looking code?
& "H:\PowerShell_Scripts\DevDskTopTools_Build_74_TEST.ps1" $global:ChkBox1 $global:ChkBox2 $global:ChkBox3 $global:ChkBox4...$global:ChkBox30
by DonJ at 2013-03-14 10:47:41
Put them in a hashtable, and pass that.
by cre8tivspirit at 2013-03-14 11:35:33
Hashtable makes storing easier but they aren't in the proper order. I can't use $Chk_Box.GetEnumerator() | Sort-Object Name as a parameter so I'm not sure how to get it all sorted before passing them.
by JasonHelmick at 2013-03-14 11:52:05
Well, they don't necessarily need to be in a particular order. You access them by key name, right? $hashtable.key gets you that value – order shouldn't matter. But, in v3, you can do an ordered hashtable if you need that.
by mjolinor at 2013-03-14 14:36:54
Will you be running this in the local session, or passing it to a remote session or background job?
by cre8tivspirit at 2013-03-15 04:11:23
I'll be running this in a local session. The GUI front end is just a means to making the script with all the installation steps selectable instead of being an all or nothing install as it currently is.
by mjolinor at 2013-03-15 04:42:53
Do those parameters have names?
The topic ‘Passing Multiple Parameters from one script to another’ is closed to new replies.