Powershell工作流程-调用似乎无效的功能

时间:2019-03-10 18:42:32

标签: powershell

我正在尝试使用PS工作流在几台远程计算机上并行执行手动卸载可执行文件,但是遇到了一些问题。这些功能本身都可以完美运行,但是当我尝试在远程VM上并行运行它时,我开始遇到问题(我试图这样做是因为顺序运行所有这些将永远花费时间。)这是我得到的输出:

请填写服务器名称列表,以从中卸载应用程序

按Enter继续...:

server01处于在线状态

server02处于在线状态

立即启用内部应用程序卸载功能

立即启用内部应用程序卸载功能

为了确保它甚至被调用,我在Uninstall函数的最后添加了一行代码,但是它没有完成执行/启动卸载过程。有见识吗?

cls
#Prompt user for server names and save them to Computers.txt 
Write-Host "Please fill out the list with server names to uninstall app from"

#Open text file to be edited by the user
ii (my personal path)\Computers.txt
pause 

#Get server names from the file and save to array
$Servers = get-content -Path (mypersonalpath)\Computers.txt

#check for online status and report, but don't remediate since this is a batch.  
#Uninstall AV for all servers that are online (in parallel with a workflow.)
workflow batchAppRemove{
        param($Servers)
        foreach -parallel ($Server in $Servers){
               isServerOnlineSkip $Server
               AppUninstall $Server
        }
}

batchAppRemove $Servers 

0 个答案:

没有答案