卸载脚本未正确执行 [英] Uninstall script not performing correctly

查看:29
本文介绍了卸载脚本未正确执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个非常简单的脚本,它只是卸载应用程序.这是我的代码:

$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'Alliance Suite G5'"写主机 $app$app.Uninstall()

我将写入主机放入只是为了确保它正在抓取正确的应用程序.这是我的输出.

<块引用>

\COMPUTERNAME\root\cimv2:Win32_Product.IdentifyingNumber="{99B66721-7E75-487C-A0C8-A4F8C4325661}",Name="AllianceSuite G5",Version="2013.2.14226.1"

__属:2

__类:__参数

__超级类:

__王朝:__参数

__RELPATH:

__PROPERTY_COUNT:1

__派生:{}

__服务器:

__命名空间:

__路径:

返回值:0

PSComputerName:

返回值为 0,但它从未真正卸载应用程序.任何帮助,将不胜感激!我在晚上运行了一些自动化测试,其中一个安装了应用程序,所以如果我可以制作一个预定的 powershell 脚本来卸载它,那就太好了.

事件查看器(注意:产品在第二条消息之前重新配置了几次):

Windows Installer 重新配置了产品.产品名称:Microsoft 身份扩展.产品版本:2.0.1459.0.产品语言:1033.制造商:Microsoft Corporation.重新配置成功或错误状态:0.开始 Windows Installer 事务:{99B66721-7E75-487C-A0C8-A4F8C4325661}.客户端进程 ID:8664.产品:Alliance Suite G5 -- 移除成功完成.Windows Installer 删除了该产品.产品名称:Alliance Suite G5.产品版本:2013.2.14226.1.产品语言:1033.制造商:United Systems &软件.删除成功或错误状态:0.

运行命令时的结果:

C:\Windows\system32>msiexec.exe/X "C:\AllianceInstall\G5\Alliance.G5.exe"/QN/L*V "C:\msilog.log

<块引用><块引用>

=== 详细日志记录开始:8/18/2014 9:42:06 构建类型:SHIP UNICODE 5.00.9200.00 调用进程:C:\Windows\system32\msiexec.exe=== MSI (c) (5C:74)

[09:42:06:039]:重置缓存的策略值 MSI (c) (5C:74)

[09:42:06:039]:机器策略值调试"是 0 MSI(C)(5C:74) [09:42:06:039]:* 运行引擎:* 产品:C:\AllianceInstall\G5\Alliance.G5.exe* 操作:* 命令行:****** MSI (c) (5C:74)

[09:42:06:039]:客户端和 >UI 是无或基本的:运行整个

<块引用>

安装在服务器上.MSI (c) (5C:74)

[09:42:06:039]:抓取执行互斥锁.MSI (c) (5C:74)

[09:42:06:061]:隐形启用.MSI(c) (5C:74)

[09:42:06:061]:尝试在之前启用所有禁用的权限在服务器 MSI 上调用安装 (c) (5C:74)

[09:42:06:064]:递增计数器以禁用关机.计数器

<块引用>

增量后:0 MSI (s) (F8:48) [09:42:06:069]: Running安装在多包事务中C:\AllianceInstall\G5\Alliance.G5.exe MSI (s) (F8:48)[09:42:06:069]:抓取执行互斥锁.MSI (s) (F8:64)

[09:42:06:071]:重置缓存的策略值 MSI (s) (F8:64)[09:42:06:071]:机器策略值调试"为 0 MSI (s) (F8:64)[09:42:06:071]:* 运行引擎:

<块引用>

 ******* 产品:C:\AllianceInstall\G5\Alliance.G5.exe******* 行动:******* 命令行:************ MSI (s) (F8:64)

[09:42:06:072]:注:1:2203 2:C:\AllianceInstall\G5\Alliance.G5.exe

<块引用>

3: -2147286960 MSI (s) (F8:64)

[09:42:06:073]:MainEngineThread 是

<块引用>

返回 1620 MSI (s) (F8:48)

[09:42:06:074]:用户策略值

<块引用>

'DisableRollback' 为 0 MSI (s) (F8:48)

[09:42:06:074]:机器策略

<块引用>

值 'DisableRollback' 为 0 MSI (s) (F8:48)

[09:42:06:074]:

<块引用>

递增计数器以禁用关机.递增后计数器:0MSI (s) (F8:48)

[09:42:06:074]:注:1:1402 2:

<块引用>

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts3: 2 MSI (s) (F8:48)

[09:42:06:074]:注:1:1402 2:

<块引用>

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts3: 2 MSI (s) (F8:48)

[09:42:06:075]:递减计数器以禁用

<块引用>

关机.如果计数器 >= 0,则关闭将被拒绝.柜台后递减:-1 MSI (c) (5C:74)

[09:42:06:076]:将计数器递减到

<块引用>

禁用关机.如果计数器 >= 0,则关闭将被拒绝.柜台递减后:-1 MSI (c) (5C:74)

[09:42:06:076]:MainEngineThread

<块引用>

返回 1620

=== 详细日志记录停止:8/18/2014 9:42:06 ===

解决方案

这似乎是一个 Installshield 套件项目 - 本质上是通过一些自定义 Installshield 构造将 MSI 文件视为单个产品的集合.它似乎是一个 setup.exe 类型的启动器,也注册为处理ARP 修复/修改.

<小时>

在聊天中 JLott 确认此命令有效:

Alliance.G5.exe/remove/s

JLott 使用的完整命令:

C:\Windows\system32>开始 C:\AllianceInstall\G5\Alliance.G5.exe/remove/s

<小时>

除上述之外,您应该能够通过找到其 GUID 并通过 msiexec.exe 卸载来卸载每个单独的 MSI.

这个简单的powershell 命令将提供带有识别码"的已安装产品列表.您可以像这样将此代码传递给 Windows 安装程序:msiexec.exe/x {GUID-HERE}

get-wmiobject -class Win32_Product

或者您可以选择以列表形式查看:

get-wmiobject Win32_Product |格式表标识编号、名称、版本

This is a really simple script that just uninstalls an application. Here is my code:

$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'Alliance Suite G5'"

Write-Host $app

$app.Uninstall()

I put the Write-Host in just to make sure it was grabbing the correct application. Here is my output.

\COMPUTERNAME\root\cimv2:Win32_Product.IdentifyingNumber="{99B66721-7E75-487C-A0C8-A4F8C4325661}",Name="Alliance Suite G5",Version="2013.2.14226.1"

__GENUS : 2

__CLASS : __PARAMETERS

__SUPERCLASS :

__DYNASTY : __PARAMETERS

__RELPATH :

__PROPERTY_COUNT : 1

__DERIVATION : {}

__SERVER :

__NAMESPACE :

__PATH :

ReturnValue : 0

PSComputerName :

The return value is 0, but it never actually uninstalls the application. Any help would be appreciated! I run some automated tests at night and one of them installs the application so it would be nice if I could make a scheduled powershell script to uninstall it.

Event Viewer (NOTE: The product is "reconfigured several times before the second message):

Windows Installer reconfigured the product. Product Name: Microsoft Identity Extensions. Product Version: 2.0.1459.0. Product Language: 1033. Manufacturer: Microsoft Corporation. Reconfiguration success or error status: 0.

Beginning a Windows Installer transaction: {99B66721-7E75-487C-A0C8-A4F8C4325661}. Client Process Id: 8664.

Product: Alliance Suite G5 -- Removal completed successfully.

Windows Installer removed the product. Product Name: Alliance Suite G5. Product Version: 2013.2.14226.1. Product Language: 1033. Manufacturer: United Systems & Software. Removal success or error status: 0.

Result when running command:

C:\Windows\system32>msiexec.exe /X "C:\AllianceInstall\G5\Alliance.G5.exe" /QN /
L*V "C:\msilog.log

=== Verbose logging started: 8/18/2014 9:42:06 Build type: SHIP UNICODE 5.00.9200.00 Calling process: C:\Windows\system32\msiexec.exe === MSI (c) (5C:74)

[09:42:06:039]: Resetting cached policy values MSI (c) (5C:74)

[09:42:06:039]: Machine policy value 'Debug' is 0 MSI (c) (5C:74) [09:42:06:039]: * RunEngine: * Product: C:\AllianceInstall\G5\Alliance.G5.exe * Action: * CommandLine: ****** MSI (c) (5C:74)

[09:42:06:039]: Client-side and >UI is none or basic: Running entire

install on the server. MSI (c) (5C:74)

[09:42:06:039]: Grabbed execution mutex. MSI (c) (5C:74)

[09:42:06:061]: Cloaking enabled. MSI(c) (5C:74)

[09:42:06:061]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (5C:74)

[09:42:06:064]: Incrementing counter to disable shutdown. Counter

after increment: 0 MSI (s) (F8:48) [09:42:06:069]: Running installation inside multi-package transaction C:\AllianceInstall\G5\Alliance.G5.exe MSI (s) (F8:48) [09:42:06:069]: Grabbed execution mutex. MSI (s) (F8:64)

[09:42:06:071]: Resetting cached policy values MSI (s) (F8:64) [09:42:06:071]: Machine policy value 'Debug' is 0 MSI (s) (F8:64) [09:42:06:071]: * RunEngine:

       ******* Product: C:\AllianceInstall\G5\Alliance.G5.exe
       ******* Action: 
       ******* CommandLine: ********** MSI (s) (F8:64)

[09:42:06:072]: Note: 1: 2203 2: C:\AllianceInstall\G5\Alliance.G5.exe

3: -2147286960 MSI (s) (F8:64)

[09:42:06:073]: MainEngineThread is

returning 1620 MSI (s) (F8:48)

[09:42:06:074]: User policy value

'DisableRollback' is 0 MSI (s) (F8:48)

[09:42:06:074]: Machine policy

value 'DisableRollback' is 0 MSI (s) (F8:48)

[09:42:06:074]:

Incrementing counter to disable shutdown. Counter after increment: 0 MSI (s) (F8:48)

[09:42:06:074]: Note: 1: 1402 2:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (F8:48)

[09:42:06:074]: Note: 1: 1402 2:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (F8:48)

[09:42:06:075]: Decrementing counter to disable

shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (5C:74)

[09:42:06:076]: Decrementing counter to

disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (5C:74)

[09:42:06:076]: MainEngineThread

is returning 1620

=== Verbose logging stopped: 8/18/2014 9:42:06 ===

解决方案

It appears this is an Installshield suite project - essentially a collection of MSI files treated as a single product via some custom Installshield constructs. It appears to be a setup.exe type launcher that also is registered to handle ARP repair / modify.


In chat JLott confirmed that this command worked:

Alliance.G5.exe /remove /s

Full command used by JLott:

C:\Windows\system32>Start C:\AllianceInstall\G5\Alliance.G5.exe /remove /s


In addition to the above, you should be able to uninstall each individual MSI by finding its GUID and uninstalling via msiexec.exe.

This simple powershell command will provide a list of installed products with "identifying code". You can pass this code to Windows installer like this: msiexec.exe /x {GUID-HERE}

get-wmiobject -class Win32_Product 

Or you could select to view it in list form:

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, Version

这篇关于卸载脚本未正确执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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