我想卸载使用Powershell具有不同版本的应用程序引用(..appref ms)。
例如,有名为ApplicationName的应用程序引用,并且有三个不同的版本。我希望ApplicationName ver1.0.11保持安装状态,而1.0.1和1.0.3将被卸载。
$InstalledApplicationNotMSI = Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall | foreach-object {Get-ItemProperty $_.PsPath}
$UninstallString = $InstalledApplicationNotMSI | ? { $_.displayname -eq "ApplicationName"} | select uninstallstring
cmd /c $UninstallString.UninstallString发布于 2020-09-13 00:29:06
您需要首先定位应用程序版本所在的字段。打开regedit.exe并导航到:
HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall然后,在PowerShell脚本中,向您在这一行上进行的查询添加一个额外的筛选条件:
$UninstallString = $InstalledApplicationNotMSI | ? { $_.displayname -eq "ApplicationName"} | select uninstallstring例如:
$UninstallString = $InstalledApplicationNotMSI | ? { ( $_.displayname -eq "ApplicationName") -and ($_.DisplayVersion - eq "2.0")} | select uninstallstring上面使用键下面的DisplayVersion条目进一步过滤结果到您需要的应用程序。
https://stackoverflow.com/questions/63843770
复制相似问题