Powershell脚本需要使用Jobs更新

时间:2018-03-28 21:15:58

标签: powershell powershell-v3.0

我打算使用PowerShell中的作业来更改它,以便它运行得更快。请提供任何指示。

$output = ForEach ($System in $sys)
{
    $LocStr= @("\\$System\c$\DC3","\\$System\c$\Users","\\$System\c$\Chef","\\$System\c$\AllProcessData","\\$System\c$\Testing_App_old","\\$System\c$\old_Testing_App","\\$System\c$\Sonic","\\$System\c$\Program Files","\\$System\c$\Installs","\\$System\c$\LOGFILES","\\$System\c$\ProgramData","\\$System\c$\Program Files (x86)","\\$System\c$\Informatica","\\$System\c$\Windows\CCM","\\$System\c$\Prod","\\$System\c$\cme"."\\$System\c$\saveE\")
    $excludeDirectories = @('*\c$\Program Files\Microsoft Monitoring Agent\Agent\*', '*\c$\Windows\System32\winrm*');

    $Extensions = @('*.cfg','*.bat','*.xml','*.properties','*.ini','*.config')
    $Exclu = @('*Monitoring*','*insxs*','*hp_manifest*','*winrm*')
    $Pattern = [RegEx]"password=|passwd=|passphrase=|pwd=|psw=|\<password\>"

    ForEach ($Loc in $LocStr
    {
        if ($Loc -notcontains "Monitoring")
        {                   
            Get-ChildItem -Path $Loc -Recurse -Include $Extensions | Select-String -Pattern $Pattern| Select-Object Path, Filename, Pattern, LineNumber, Line
        }
    }
}



$output | Export-Csv  $Param2

0 个答案:

没有答案