For example, I have 3 hashtables with different key-values:
$Queue1 = @{
QueueName = 'MyTestQueue1'
LockDuration = 'PT1M1'
AutoDeleteOnIdle = 'P10675199DT2H48M5.4775807S1'
}
$Queue2 = @{
QueueName = 'MyTestQueue2'
LockDuration = 'PT1M2'
AutoDeleteOnIdle = 'P10675199DT2H48M5.4775807S2'
}
$Queue3 = @{
QueueName = 'MyTestQueue3'
LockDuration = 'PT1M3'
AutoDeleteOnIdle = 'P10675199DT2H48M5.4775807S3'
}
Is it possible to combine them in the array and use each key-value inside the foreach?
foreach($hashtable in $Hashtables){
$QueueName = $hashtable.QueueName
$LockDuration = $hashtable.LockDuration
$AutoDeleteOnIdle = $hashtable.AutoDeleteOnIdle
# Some code here
}
$Hashtables = @($Queue1, $Queue2, $Queue3), does this work?