Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Find Index Position in two dimensional array;

$
0
0
hi I have a list of databases and their status in array $DBMirroringInfo.

foreach ($db in $dbs)
{
....
$DBMirroringInfo +=,@($db,"FailOver In Progress")
....
 }
I would like to set the status for particular db in the $DBMirroringInfo. I am trying to find the index in the $DBMirroringInfo so it's status can be updated?
Something like this

foreach ($db in $dbs)
{
Failover Db's
If Successful
$DBMirroringInfo ($db "Mirroring Failover Completed")
Else
$DBMirroringInfo ($db "Mirror Failover Unsuccessful Please Contact DBA")

}
Finally Print result on screen
Foreach ($DBInfo in $DBMirroringInfo)
{

write-host $DBInfo[0] $DBInfo[1]

}

Thanks

Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>