同时为用户

时间:2017-12-22 14:44:21

标签: powershell powershell-v2.0

我正在使用PowerShell开发SQL运行状况检查。因此,它检查数据库的状态并输出文本以控制是否需要注意。我有第一个ps1来加载各种检查,但我需要他们开始在parralel加载下面的ps1&#s; s。我需要在powershell v2上工作。我是否需要为每一行使用启动作业 这是我的代码

$Output = @()
$BackupHistory = @()
$script = $myInvocation.MyCommand.Definition
$scriptPath = Split-Path -parent $script 

Start-Process -FilePath powershell.exe -ArgumentList "-noexit","$scriptpath\SQLHealthVLF.ps1 $Env" -Wait -WindowStyle Maximized
Start-Process -FilePath powershell.exe -ArgumentList "-noexit","$scriptpath\SQLHealthBackup.ps1 $Env" -Wait -WindowStyle Maximized
Start-Process -FilePath powershell.exe -ArgumentList "-noexit","$scriptpath\SQLHealthIOAlerts.ps1 $Env" -Wait -WindowStyle Maximized
Start-Process -FilePath powershell.exe -ArgumentList "-noexit","$scriptpath\SQLDisksUsage.ps1 $Env" -Wait -WindowStyle Maximized

当前发生的是一次加载,然后我需要关闭它然后下一个加载。这并不能保证脚本的一致性。

0 个答案:

没有答案