My issue is with passing the list of servers from an array variable to another script I call reboot. The array list get converted to PSCustomObject when in the other server.
code to get servers;
Import-Csv .\SMachines\Servers.csv | Where-Object {$_.ENVName -eq "RND"} | Select-Object -Property ENVName,FND,DB,APPS | Foreach {[void]$SRVList.Add($_)}
.\ParamBypass.bat /reboot.ps1 $SRVList
Expected List format
ENVName FND DB APPS ------- --- -- ---- RND srv003529 srv002983 srv003528 RND srv003527 RND srv003526 RND srv003530
variable $SRVList output whiles in reboot.ps1
@{ENVName=RND; FND=srv003529; DB=srv002983; APPS=srv003528}I run this script with a batch file bypass;
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '"%PowerShellScriptPath%"' -ServerList '%2' -SEnv '%3' -SCreD '%4'"Thanks in advance.