I have a hashtable used in a job, each hash.key is a job name:
$myhashtable = @{
'somelocation' = 'somevalue'
'otherlocation' = 'othervalue'
}
I run the hashtable against a function, the function is a Start-Job
that runs for each object in the hashtable.
foreach ( $location in $myhashtable.GetEnumerator() )
{
SomeFunction
}
I then get the names of stopped jobs:
$joblist = Get-Job | Where-Object { $_.State -eq "Stopped" }
$joblist = $joblist.name
Trying to do the same as above against the function but only for the jobs that have stopped:
foreach( $location in $myhashtable.GetEnumerator() )
{
if $location.key matches an object in $joblist}(
do SomeFunction for those $location.keys)
}
I've tried various foreach
if
and where
but can't hit on it.
Thanks!