I have a script – Master.ps1:
Get-ClusterResource "Cluster IP Address" | Set-ClusterParameter -Multiple @{"Address"="xx.xx.x.xxx";"Network"="Cluster Network 1";"SubnetMask"="zzz.zzz.zzz.zzz"};
Get-ClusterResource "SQL IP Address 1 (Host-Name-SQL)" | Set-ClusterParameter -Multiple @{"Address"="xx.xx.x.yyy";"Network"="Cluster Network 1";"SubnetMask"="zzz.zzz.zzz.zzz"};
Start-ClusterResource -Name "CLuster IP Address";
Start-ClusterResource -Name "CLuster Name";
Start-ClusterResource -Name "SQL Server" -Wait 0;
Start-ClusterResource -Name "SQL Server Agent"
I also have a file PS_Param.txt with parameters:
param(
$ClusterIP="CLuster IP Address",
$Address1="xx.xx.x.xxx",
$Network1="Cluster Network 1",
$SubnetMask1="zzz.zzz.zzz.zzz",
$SQLServer="SQL IP Address 1 (Host-Name-SQL)",
$Address2="xx.xx.x.yyy",
$Network2="Cluster Network 1",
$SubnetMask2="zzz.zzz.zzz.zzz"
)
I created a new script – Master-Param.ps1:
param(
[string]$ClusterIP,
[string]$Address1,
[string]$Network1,
[string]$SubnetMask1,
[string]$SQLServer,
[string]$Address2,
[string]$Network2,
[string]$SubnetMask2
)
Get-ClusterResource $ClusterIP | Set-ClusterParameter -Multiple @{"Address"=$Address1;"Network"=$Network1;"SubnetMask"=$SubnetMask1};
Get-ClusterResource $SQLServer | Set-ClusterParameter -Multiple @{"Address"=$Address2;"Network"=$Network2;"SubnetMask"=$SubnetMask2};
Start-ClusterResource -Name "CLuster IP Address";
Start-ClusterResource -Name "CLuster Name";
Start-ClusterResource -Name "SQL Server" -Wait 0;
Start-ClusterResource -Name "SQL Server Agent"
So, it works if I run it like this:
Master-Param.ps1 "Cluster IP Address" "xx.xx.x.xxx" "Cluster Network 1" "zzz.zzz.zzz.zzz" "SQL IP Address 1 (Host-Name-SQL)" "xx.xx.x.yyy" "Cluster Network 1" "zzz.zzz.zzz.zzz" -Verb RunAs -Force
I want to pass the actual values of the parameters from PS_Param.txt directly into a Master-Param.ps1, so I don’t have to list all the values in a command line and if anything changes (like IPs or names), I only have a txt file to edit.
I would really appreciate any help I could get.
I really cannot find any information on how to accomplish what I want to do and if it’s even possible.
I would appreciate any help or maybe pointing me to a right direction.