如何使用 PowerShell 卸载应用程序? [英] How can I uninstall an application using PowerShell?

查看:118
本文介绍了如何使用 PowerShell 卸载应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以使用 PowerShell 连接到标准的添加或删除程序"功能以卸载现有应用程序?或者检查是否安装了应用程序?

Is there a simple way to hook into the standard 'Add or Remove Programs' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed?

推荐答案

$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -match "Software Name" 
}

$app.Uninstall()

Rob 找到了另一种使用 Filter 参数的方法:

Rob found another way to do it with the Filter parameter:

$app = Get-WmiObject -Class Win32_Product `
                     -Filter "Name = 'Software Name'"

这篇关于如何使用 PowerShell 卸载应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆