在多台机器上使用Powershell中的psexec删除CS6

时间:2015-12-16 11:00:25

标签: xml powershell command psexec

尝试通过在powershell中运行psexec来运行脚本以在多台计算机上删除CS6。删除CS6(将XML文件附加到本地安装的安装文件)的命令在命令行中使用psexec运行时有效,但在使用Powershell时失败。我为每台机器得到的错误是

  

“C:\ Program Files(x86)\ Common Files \ Adob​​e \ OOBE \ PDApp \ DWA \ Setup.exe   退出VM08002745E4AD,错误代码为16。“

有什么想法吗?

下面的脚本

#get list of computers    
$computers = gc "C:\Remove CS6\adobe_cs6_hosts.txt"

#Loop through each computer
Foreach ( $computer in $computers )
{
    #copy XML file
    Copy "C:\Remove CS6\uninstall-en_IL.xml" "\\$computer\c$" -force

    #Uninstall CS6
    try
    {
        "$computer attempting 32 bit uninstall"
        $output = cmd /c "psexec \\$computer `"C:\Program Files\Common Files\Adobe\OOBE\PDApp\DWA\Setup.exe`" --mode=Silent --deploymentFile=`"\\$computer\c$\uninstall-en_IL.xml`" 2>&1"

        "$computer $output"
    }
    catch
    {
        "$computer attempting 64 bit uninstall"
    }

    try
    {
        $output = cmd /c "psexec \\$computer  `"C:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\DWA\Setup.exe" --mode=Silent --deploymentFile="\\$computer\c$\uninstall-en_IL.xml`" 2>&1"
        "$computer $output"
    }
    catch
    {
        "Failed to uninstall CS6"
    }            
}    
pause 

Foreach ( $computer in $computers )
{
    #Delete uninstall.xml
    Remove-item “\\$computer\c$\uninstall-en_IL.xml”   
}

1 个答案:

答案 0 :(得分:0)

原来我需要摆脱双连字符,例如`--