Модераторы: mihanik
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> KB908002, проверка, утановлен ли патч KB908002 
:(
    Опции темы
ruffpavel
  Дата 24.12.2008, 14:27 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 1
Регистрация: 24.12.2008

Репутация: нет
Всего: нет



Здравствуйте!

У меня проблема, связанная с инсталлятором - перед его запуском нужно сделать корректную проверку на то, установлен ли патч KB908002 в системе. Если патч полностью установлен, то установку патча пропускать.

Привожу текущее содержание product.xml для KB908002:

Код

<?xml version="1.0" encoding="utf-8" ?>
<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.OtkLoader.2.0">

  <RelatedProducts>
    <DependsOnProduct Code="Microsoft.Net.Framework.2.0" />
  </RelatedProducts>

  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="lockbackRegKey.msi"/>
    <PackageFile Name="extensibilityMSM.msi"/>
    <PackageFile Name="office2003-kb907417sfxcab-ENU.exe"/>
  </PackageFiles>

  <InstallChecks>
        <MsiProductCheck Property="lockbackRegKeyInstalled" Product="{64F3B15C-24C7-4B2B-9B72-65CCBBD7F06B}"/>
        <MsiProductCheck Property="extensibilityMSMInstalled" Product="{09959E11-AD5D-408E-96AF-E3346954D6B8}"/>
  </InstallChecks>
    
  <Commands Reboot="Defer">
    <Command PackageFile="lockbackRegKey.msi" Arguments=' /quiet'>
        <InstallConditions>
            <BypassIf Property="lockbackRegKeyInstalled" Compare="ValueGreaterThanOrEqualTo" Value="1"/>
        </InstallConditions>
      <ExitCodes>
        <DefaultExitCode Result="Success"/>
      </ExitCodes>
    </Command>

    <Command PackageFile="extensibilityMSM.msi" Arguments=' /quiet'>
        <InstallConditions>
            <BypassIf Property="extensibilityMSMInstalled" Compare="ValueGreaterThanOrEqualTo" Value="1"/>
        </InstallConditions>
      <ExitCodes>
        <DefaultExitCode Result="Success"/>
      </ExitCodes>
    </Command>

    <Command PackageFile="office2003-kb907417sfxcab-ENU.exe" Arguments=' /quiet'>
      <ExitCodes>
        <DefaultExitCode Result="Success"/>
      </ExitCodes>
    </Command>
  </Commands>
</Product>



Патч состоит из трёх составляющих: lockbackRegKey.msi, extensibilityMSM.msi, office2003-kb907417sfxcab-ENU.exe и проверки нужно производить для каждой из них, но для kb907417, похоже, нет ProductCode.
office2003-kb907417sfxcab-ENU.exe с помощью ohotfix.exe (Microsoft Office Hotfix Installer) регистрирует otkloadr.dll в реестре: 

HKEY_CLASSES_ROOT (COM-сервер), 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VSTO\OTKLoadr, 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components

и копирует otkloadr.dll в каждую установленную версию Office в папку addins.

Как можно просто проверить, установлен ли kb907417 (или сразу целиком KB908002) в системе?

Заранее благодарю.
PM MAIL   Вверх
mihanik
Дата 6.1.2009, 18:53 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


-=Белый Медведь=-
****


Профиль
Группа: Комодератор
Сообщений: 4054
Регистрация: 24.4.2006
Где: г. Тверь

Репутация: 9
Всего: 109



Можно.

Вот так мы ищем список всех программ, установленных на компе
Код

' List All Installed Software

' Windows Server 2003 : Yes
' Windows XP : Yes
' Windows 2000 : Yes
' Windows NT 4.0 : Yes
' Windows 98 : Yes


Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
strComputer = "."
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
strEntry1a = "DisplayName"
strEntry1b = "QuietDisplayName"
strEntry2 = "InstallDate"
strEntry3 = "VersionMajor"
strEntry4 = "VersionMinor"
strEntry5 = "EstimatedSize"

Set objReg = GetObject("winmgmts://" & strComputer & _
 "/root/default:StdRegProv")
objReg.EnumKey HKLM, strKey, arrSubkeys
WScript.Echo "Installed Applications" & VbCrLf
For Each strSubkey In arrSubkeys
  intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
   strEntry1a, strValue1)
  If intRet1 <> 0 Then
    objReg.GetStringValue HKLM, strKey & strSubkey, _
     strEntry1b, strValue1
  End If
  If strValue1 <> "" Then
    WScript.Echo VbCrLf & "Display Name: " & strValue1
  End If
  objReg.GetStringValue HKLM, strKey & strSubkey, _
   strEntry2, strValue2
  If strValue2 <> "" Then
    WScript.Echo "Install Date: " & strValue2
  End If
  objReg.GetDWORDValue HKLM, strKey & strSubkey, _
   strEntry3, intValue3
  objReg.GetDWORDValue HKLM, strKey & strSubkey, _
   strEntry4, intValue4
  If intValue3 <> "" Then
     WScript.Echo "Version: " & intValue3 & "." & intValue4
  End If
  objReg.GetDWORDValue HKLM, strKey & strSubkey, _
   strEntry5, intValue5
  If intValue5 <> "" Then
    WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
  End If
Next


Вот такое ты получаешь на выходе:
Цитата

‘ҐаўҐа б業 аЁҐў Windows (Microsoft R) ўҐабЁп 5.7
c Љ®аЇ®а жЁп Њ ©Єа®б®дв (Microsoft Corp.), 1996-2001. ‚ᥠЇа ў  § йЁйҐ­л.

Installed Applications


Display Name: Microsoft Internationalized Domain Names Mitigation APIs
Install Date: 20090106

Display Name: Windows Internet Explorer 7
Install Date: 20090106

Display Name: Windows Genuine Advantage Validation Tool (KB892130)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ¤«п Windows XP (KB898461)

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB923789)

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB938464)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB946648)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB950762)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB950974)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB951066)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB951376-v2)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB951698)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ¤«п Windows XP (KB951978)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Їа®ЁЈа뢠⥫п Windows Media - (KB952069)
Install Date: 20090106

Display Name: €бЇа ў«Ґ­ЁҐ ¤«п Windows XP (KB952287)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB952954)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB954211)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB954459)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB954600)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB955069)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ¤«п Windows XP (KB955839)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows Internet Explorer 7 (KB956390)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB956391)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB956802)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB956803)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB956841)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB957095)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB957097)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows Internet Explorer 7 (KB958215)
Install Date: 20090106

Display Name: ЋЎ­®ў«Ґ­ЁҐ ЎҐ§®Ї б­®бвЁ ¤«п Windows XP (KB958644)
Install Date: 20090106

Display Name: Microsoft National Language Support Downlevel APIs
Install Date: 20090106

Display Name: Windows Genuine Advantage Validation Tool (KB892130)

Display Name: Windows Genuine Advantage Notifications (KB905474)
Install Date: 20090106

Display Name: Windows XP Service Pack 3
Install Date: 20090105

Display Name: WebFldrs XP
Install Date: 20090106
Version: 9.50
Estimated Size: 2,559 megabytes

Display Name: Microsoft .NET Framework 2.0 Service Pack 1
Install Date: 20090106
Version: 2.1
Estimated Size: 186,459 megabytes

Display Name: Virtual Machine Additions
Install Date: 20090106
Version: 13.820
Estimated Size: 0,955 megabytes



Ну... Останется только проанализировать список, выдаваемый скриптом...



--------------------
Программистами не рождаются, - это родовая травма...
user posted imageuser posted image
PM MAIL WWW ICQ   Вверх
mihanik
Дата 7.1.2009, 18:08 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


-=Белый Медведь=-
****


Профиль
Группа: Комодератор
Сообщений: 4054
Регистрация: 24.4.2006
Где: г. Тверь

Репутация: 9
Всего: 109



Или вот ещё...

Цитата

How Can I Determine if a Particular Patch is Installed?

 

Hey, Scripting Guy! How can I use a script to determine if a particular patch has been installed?

-- GM

  

Hey, GM. You know, not too long ago this would have been a question we might have “accidentally” dropped in the wastebasket and pretended never to have seen. Why? Well, back in the old days the only way to get information about patches, hot fixes, and other updates was to use the WMI class Win32_QuickFixEngineering. That was OK, but for various reasons Win32_QuickFixEngineering would occasionally miss a patch that really was installed; even worse, on Windows 2000 machines Win32_QuickFixEngineering would sometimes hang and not return any information. (How do you fix that problem? By installing a patch, of course.) Not a pretty picture by any means.

 

But those days are gone. Now, thanks to the new and very-much improved Windows Update service, it’s very easy to determine which updates have and have not been installed on a computer. For example, here’s a script that tells us whether the patch Security Update for Windows XP (KB899587) has been installed on a computer:

 

Код

Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
Set objResults = objSearcher.Search("Type='Software'")
Set colUpdates = objResults.Updates

For i = 0 to colUpdates.Count - 1
    If colUpdates.Item(i).Title = _
        "Security Update for Windows XP (KB899587)" Then
        If colUpdates.Item(i).IsInstalled <> 0 Then
            Wscript.Echo "This update is installed."
            Wscript.Quit
        Else
            Wscript.Echo "This update is not installed."
            Wscript.Quit
        End If
    End If
Next

Wscript.Echo "This update is not installed."

 

We won’t go through each line of code in detail; explaining the ins and outs of the Windows Update service goes a bit beyond the scope of this column. If you’d like more information about Windows Update (and, in particular, objects like Microsoft.Update.Session) please see our Tales from the Script column I’ll Get You, My Pretty…And We’ll Manage Windows Update, Too!

 

We will note, however, that despite the presence of the Search method we aren’t really searching for a particular update. Searching implies going out and, with pinpoint accuracy, locating just the item of interest. We can’t really do that. Instead, what we’re doing here is returning a collection of all the updates and then sifting through that entire collection, looking for an update with the title Security Update for Windows XP (KB899587). The end result is the same, but the process by which we achieve that end result is a little different.

 

No, that doesn’t make any difference. Just thought you’d like to know.

 

So what is the process we employ here? Well, we begin by using these four lines of code to retrieve the updates collection for the local computer:

 

Код

Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcherSet 
objResults = objSearcher.Search("Type='Software'")
Set colUpdates = objResults.Updates

 

Note. Yes, this script can be run against a remote computer. For more information, see the Tales from the Script column.

 

After retrieving the collection we set up a For Next loop to walk through all the items. Inside that loop we use this line of code to determine whether the update Title is equal to Security Update for Windows XP (KB899587):

 

Код

If colUpdates.Item(i).Title = _
    "Security Update for Windows XP (KB899587)" Then

 

Let’s suppose that the Title is equal to Security Update for Windows XP (KB899587). In that case, we next check the value of the IsInstalled property. If IsInstalled is equal to 0, then the update is not actually installed (installation might have failed, or the update might have been installed but then removed). If IsInstalled does not equal 0, then the update is installed. We check the value, and then echo the appropriate message:

 

Код

If colUpdates.Item(i).IsInstalled <> 0 Then
    Wscript.Echo "This update is installed."
    Wscript.Quit
Else
    Wscript.Echo "This update is not installed."
    Wscript.Quit
End If

 

You might notice that, after echoing our message, we terminate the script. Why? Well, update titles are unique: now that we’ve found the update in question there’s no need to continue walking through the rest of the collection. Therefore, we might as well terminate the script and get on with our lives.

 

And what if the Title isn’t equal to Security Update for Windows XP (KB899587)? In that case we simply loop around and check the next item in the collection. If we never do find an update with the specified title we’ll eventually exit the loop, and then execute the last line of code, which simply reports that the update is not installed.




Это сообщение отредактировал(а) mihanik - 7.1.2009, 18:10


--------------------
Программистами не рождаются, - это родовая травма...
user posted imageuser posted image
PM MAIL WWW ICQ   Вверх
Dobermann
Дата 7.1.2009, 18:31 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 992
Регистрация: 7.1.2008

Репутация: нет
Всего: 0



Цитата(mihanik @  6.1.2009,  18:53 Найти цитируемый пост)
Display Name: Microsoft .NET Framework 2.0 Service Pack 1Install Date: 20090106Version: 2.1Estimated Size: 186,459 megabytes

Обновлять не пора?  smile 
PM   Вверх
mihanik
Дата 7.1.2009, 18:48 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


-=Белый Медведь=-
****


Профиль
Группа: Комодератор
Сообщений: 4054
Регистрация: 24.4.2006
Где: г. Тверь

Репутация: 9
Всего: 109



Цитата(Dobermann @  7.1.2009,  18:31 Найти цитируемый пост)
Обновлять не пора?    


Не ходовая часть!
На скорость не влияет!
(По крайней мере у меня в системе... Сервак...)

Добавлено через 1 минуту и 14 секунд
А...
Блин!!!
Забыл!!!
Это я на своей виртуалке запускал!
 smile 



--------------------
Программистами не рождаются, - это родовая травма...
user posted imageuser posted image
PM MAIL WWW ICQ   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Правила форума "Программирование, связанное с MS Office"
mihanik staruha

Запрещается!

1. Публиковать ссылки на вскрытые компоненты

2. Обсуждать взлом компонентов и делиться вскрытыми компонентами



  • Несанкционированная реклама на форуме запрещена
  • Пожалуйста, давайте своим темам осмысленный, информативный заголовок. Вопль "Помогите!" таковым не является.
  • Чем полнее и яснее Вы изложите проблему, тем быстрее мы её решим.
  • Оставляйте свои записи в "Книге отзывов о работе администрации"
  • А вот тут лежит FAQ нашего подраздела


Если Вам понравилась атмосфера форума, заходите к нам чаще!
С уважением mihanik и staruha.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Программирование, связанное с MS Office | Следующая тема »


 




[ Время генерации скрипта: 0.0462 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.