pdp320921 发表于 2011-3-3 20:36:06

[已解决]关于软件的卸载问题

本帖最后由 pdp320921 于 2011-3-31 22:53 编辑

软件的自动卸载问题:

如果采用静默卸载,可是由于各种安装软件的封包不同,静默参数不同,而且静默参数有不易获得

如果去注册表里查询Uninstall String有时也不一定能达到最终效果

寻求能够对任何软体适用或者比较通用的方法达到自动化卸载?

用AU3从控制面板里去卸载如何能够实现?对于控制面板窗口大小该如何考量?

smartzbs 发表于 2011-3-4 09:34:31

获取控制面版中可卸载程序信息:
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer& @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Caption: " & $objItem.Caption & @CRLF
      $Output &= "Description: " & $objItem.Description & @CRLF
      $Output &= "IdentifyingNumber: " & $objItem.IdentifyingNumber & @CRLF
      $Output &= "InstallDate: " & $objItem.InstallDate & @CRLF
      $Output &= "InstallDate2: " & WMIDateStringToDate($objItem.InstallDate2) & @CRLF
      $Output &= "InstallLocation: " & $objItem.InstallLocation & @CRLF
      $Output &= "InstallState: " & $objItem.InstallState & @CRLF
      $Output &= "Name: " & $objItem.Name & @CRLF
      $Output &= "PackageCache: " & $objItem.PackageCache & @CRLF
      $Output &= "SKUNumber: " & $objItem.SKUNumber & @CRLF
      $Output &= "Vendor: " & $objItem.Vendor & @CRLF
      $Output &= "Version: " & $objItem.Version & @CRLF
   Next
   ConsoleWrite($Output)
   FileWrite(@TempDir & "\Win32_Product.TXT", $Output )
   Run(@Comspec & " /c start " & @TempDir & "\Win32_Product.TXT" )
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Product" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

pdp320921 发表于 2011-3-9 21:35:35

还是没能解决问题啊?哪位大侠再给点建议啊~~
页: [1]
查看完整版本: [已解决]关于软件的卸载问题