随着Notepad ++最新版本7.x的升级,我们的部门决定推出最新的x64版本。但是,我遇到了一个问题,我不能为我的生活得到旧版本的Notepad ++来卸载。最初,它是一个简单的包管理器,它使用我们之前的x32版本的程序创造了奇迹,但是随着迁移到x64,我们无法卸载该程序。
class notepadpp {
require vcredist
$version = "7"
if($version == "7") {
$filename = "${commonfiles::location}\\notepadpp\\${version}\\npp.${version}.Installer.x64.exe"
} else {
$filename = "${commonfiles::location}\\notepadpp\\${version}\\npp.${version}.Installer.exe"
}
if ("${::notepad_uninstall_needed}" == "true"){
exec { 'Uninstalling x86 version of Notepad++':
command => 'powershell -ExecutionPolicy RemoteSigned -file C:\ProgramData\PuppetLabs\puppet\etc\environments\common\modules\apps\notepadpp\manifests\Uninstall.ps1',
before => Package['Notepad++'],
}
}
package { "Notepad++":
ensure => "${version}",
source => $filename,
install_options => ['/S', "/no-startup", "/global"]
}
}
我也试过
exec
...
command => "C:\Program Files (x86)\Notepad++\Uninstall.exe /S"
or
command => "'C:\Program Files (x86)\Notepad++\Uninstall.exe' /S"
这些都不会产生正确的结果。它表示Executed successfully
运行powershell -File
选项,但它实际上从未卸载过该应用程序。用我刚刚得到的命令
returns (err): change from notrun to 0 failed: No such file or directory - CreateProcess
。
.Ps1文件如下所示:
"C:\<path to Uninstaller>\uninstall.exe" /S
真正的问题在于Puppet模块。我真的不想利用CMD或PowerShell来完成这里的任务。我知道这可能是问题的解决方案,但我真的不明白为什么Puppet Package不会为我卸载程序。