I have a script "Deploy.PS1" that I am testing. In it I pass a few parameters:
param(
[Parameter(Mandatory = $True,valueFromPipeline=$true)][String] $param1,
[Parameter(Mandatory = $True,valueFromPipeline=$true)][String] $param2,
[Parameter(Mandatory = $True,valueFromPipeline=$true)][String] $param3,
[Parameter(Mandatory = $True,valueFromPipeline=$true)][String] $param4,
[Parameter(Mandatory = $True,valueFromPipeline=$true)][String] $param5
)
Currently when I run the script I must run the script and pass the parameters ".\Deploy.PS1 p1 p2 p3 p4 p5" and it runs fine. I am trying to create a .xml document that has the parameters already in it. For that, I found a thread that helped me out. Right now that .xml file looks like this:
<Deploy_Params>
<param>
<param1>p1</param1>
<param2>p2</param2>
<param3>p3</param3>
<param4>p4</param4>
<param5>p5</param5>
</param>
<param>
<param1>a1</param1>
<param2>a2</param2>
<param3>a3</param3>
<param4>a4</param4>
<param5>a5</param5>
</param>
<param>
<param1>b1</param1>
<param2>b2</param2>
<param3>b3</param3>
<param4>b4</param4>
<param5>b5</param5>
</param>
</Deploy_Params>
What I need additional help with is passing different parameters depending on which environment I want to deploy to.
For example: I want to run Deploy.PS1 with either parameters "p1 p2 p3 p4 p5", "a1 a2 a3 a4 a5", or "b1 b2 b3 b4 b5". How would I specify in the Deploy.PS1 script or .xml file that I want to pass only the p, a, or b parameters depending on if I want to use either the p, a, or b environment?
(Note: I am new to Stack Overflow and programming in general, I have read several other threads on here that are similar to my question but still cannot seem to resolve my issue. Please bear with me, I can provide additional info or code if needed. Thanks)