0

这是我第一次使用start-jobs,它不能正常工作,是我用错了吗?

$dagName = "dag Name";
$dagObject = Get-DatabaseAvailabilityGroup -Identity $dagName;

$servers = New-Object System.Collections.ArrayList;
foreach($server in $dagObject.Servers)
{
    $servers.Add($server) | Out-Null;
}

$getExchangeServers = @();
$getMailboxDatabases = @();
$getMailboxDatabasesWithStatus = @();

Start-Job -ScriptBlock {foreach ($server in $servers) {$getExchangeServers += get-exchangeserver $server;}}
Start-Job -ScriptBlock {foreach ($server in $servers) {$getMailboxDatabases += Get-MailboxDatabase -Server $server;}}
Start-Job -ScriptBlock {foreach ($server in $servers) {$getMailboxDatabasesWithStatus += Get-MailboxDatabase -Server $server -Status;}}
4

0 回答 0