This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
userspace:windows_updates [2013/03/01 17:07] tobias [Windows Updates (Alternative)] |
userspace:windows_updates [2021/08/23 08:37] (current) |
||
|---|---|---|---|
| Line 230: | Line 230: | ||
| Das Script ist getestet auf Windows 7 x64 und x86 sollte aber auch auf Windows XP funktionieren wenn dort die Powershell installiert ist! | Das Script ist getestet auf Windows 7 x64 und x86 sollte aber auch auf Windows XP funktionieren wenn dort die Powershell installiert ist! | ||
| + | === Folgendes muss beachtet werden: === | ||
| + | - Wenn Optionale Updates angeboten werden, werden diese nicht automatisch installiert und das Powershellscript wird nie 0 zurückgeben! | ||
| - | <code winst> | + | - Das Script hat eine Geringe Priorität, daher wird es nahezu als letztes ausgeführt. Das ist wichtig damit alle Produkte die darüber mit Updates versorgt werden, diese auch enthalten. |
| + | ==== Setup.ins ==== | ||
| + | <code winst> | ||
| [ACTIONS] | [ACTIONS] | ||
| - | DefVar $Flag$ | + | |
| + | ; -------- Define Variables ------------------------- | ||
| DefVar $WinstRegKey$ | DefVar $WinstRegKey$ | ||
| DefVar $RebootRegVar$ | DefVar $RebootRegVar$ | ||
| Line 241: | Line 246: | ||
| DefVar $trim$ | DefVar $trim$ | ||
| DefVar $INST_SystemType$ | DefVar $INST_SystemType$ | ||
| + | Defvar $outstanding$ | ||
| + | DefVar $ProductId$ | ||
| + | DefVar $RebootCounter$ | ||
| + | DefVar $NumberOfNeededReboots$ | ||
| + | Set $WinstRegKey$ = " | ||
| + | Set $ProductID$ = " | ||
| Set $INST_SystemType$ = GetSystemType | Set $INST_SystemType$ = GetSystemType | ||
| + | Set $NumberOfNeededReboots$ = GetProductProperty(" | ||
| + | ShowBitmap " | ||
| - | ; | + | ; ------------- |
| - | ; InstallUpdates | + | |
| - | ; | + | if (GetRegistryStringValue32(" |
| - | if ($INST_SystemType$ = "64 Bit System") | + | set $RebootCounter$ = " |
| - | DOSBatch_install_updates_x64 | + | |
| else | else | ||
| - | DOSBatch_install_updates_x86 | + | Set $RebootCounter$ = GetRegistryStringValue32(" |
| endif | endif | ||
| - | ; | + | ; |
| - | ; Check & Reboot | + | |
| - | ; | + | |
| - | winbatch_psactivate | + | |
| - | set $counterString$ = getOutStreamFromSection(' | + | |
| - | + | ||
| - | set $CounterVar$ = takeString(0, | + | |
| - | set $trim$ = trim($CounterVar$) | + | |
| - | + | ||
| - | + | ||
| - | if $trim$ = " | + | |
| - | comment "Keine Updates Verfügbar" | + | |
| - | ExitWindows /Reboot | + | |
| - | + | ||
| - | else | + | |
| - | ExitWindows / | + | |
| - | comment weitere Updates verfügbar reboot wurde initialisiert ! | + | |
| + | comment $RebootCounter$ | ||
| + | comment $NumberOfNeededReboots$ | ||
| + | if ($RebootCounter$ INT<= $NumberOfNeededReboots$) | ||
| + | |||
| + | if ($INST_SystemType$ = "64 Bit System" | ||
| + | DOSBatch_install_updates_x64 | ||
| + | else | ||
| + | DOSBatch_install_updates_x86 | ||
| + | endif | ||
| + | |||
| + | ; | ||
| + | winbatch_psactivate | ||
| + | set $counterString$ = getOutStreamFromSection(' | ||
| + | set $CounterVar$ = takeString(0, | ||
| + | set $trim$ = trim($CounterVar$) | ||
| + | set $outstanding$ = $trim$ | ||
| + | opsiServiceCall_report_pending_updates | ||
| + | |||
| + | if $trim$ = " | ||
| + | comment "Keine Updates Verfuegbar" | ||
| + | set $RebootCounter$ = calculate($NumberOfNeededReboots$+" | ||
| + | Registry_SaveRebootCounter | ||
| + | ExitWindows /Reboot | ||
| + | else | ||
| + | set $RebootCounter$ = calculate($RebootCounter$+" | ||
| + | opsiServiceCall_report_reboot | ||
| + | Registry_SaveRebootCounter | ||
| + | ExitWindows / | ||
| + | comment " | ||
| + | endif | ||
| + | |||
| + | else | ||
| + | set $RebootCounter$ = " | ||
| + | Registry_SaveRebootCounter | ||
| + | Comment " | ||
| endif | endif | ||
| + | |||
| + | ; ----------- Sections ------------------------------------------------------------------------------------- | ||
| [DOSBatch_install_updates_x64] | [DOSBatch_install_updates_x64] | ||
| - | %scriptpath%/ | + | %scriptpath%/ |
| [DOSBatch_install_updates_x86] | [DOSBatch_install_updates_x86] | ||
| - | %scriptpath%/ | + | %scriptpath%/ |
| [winbatch_psactivate] | [winbatch_psactivate] | ||
| powershell Set-ExecutionPolicy RemoteSigned | powershell Set-ExecutionPolicy RemoteSigned | ||
| - | |||
| - | |||
| [execWith_powershell] | [execWith_powershell] | ||
| Line 296: | Line 326: | ||
| write-host $list.updates.count | write-host $list.updates.count | ||
| + | [Registry_SaveRebootCounter] | ||
| + | openKey [$WinstRegKey$] | ||
| + | set " | ||
| + | |||
| + | [opsiServiceCall_report_pending_updates] | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| + | |||
| + | [opsiServiceCall_report_reboot] | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ] | ||
| </ | </ | ||
| + | ===control=== | ||
| + | <code winst> | ||
| + | [Package] | ||
| + | version: 1 | ||
| + | depends: | ||
| + | incremental: | ||
| + | |||
| + | [Product] | ||
| + | type: localboot | ||
| + | id: windowsupdates | ||
| + | name: Windows Updates | ||
| + | description: | ||
| + | advice: | ||
| + | version: 1.5 | ||
| + | priority: -89 | ||
| + | licenseRequired: | ||
| + | productClasses: | ||
| + | setupScript: | ||
| + | uninstallScript: | ||
| + | updateScript: | ||
| + | alwaysScript: | ||
| + | onceScript: | ||
| + | customScript: | ||
| + | userLoginScript: | ||
| + | |||
| + | [ProductProperty] | ||
| + | type: unicode | ||
| + | name: ausstehend | ||
| + | multivalue: False | ||
| + | editable: True | ||
| + | description: | ||
| + | values: [" | ||
| + | default: [" | ||
| + | |||
| + | [ProductProperty] | ||
| + | type: unicode | ||
| + | name: rebootcounter | ||
| + | multivalue: False | ||
| + | editable: True | ||
| + | description: | ||
| + | values: [" | ||
| + | default: [" | ||
| + | |||
| + | [ProductProperty] | ||
| + | type: unicode | ||
| + | name: numberofneededreboots | ||
| + | multivalue: False | ||
| + | editable: True | ||
| + | description: | ||
| + | values: [" | ||
| + | default: [" | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Neuerungen / News: ==== | ||
| + | --- // | ||
| + | |||
| + | - Report pending Updates to Configed (realised with Produtctproperty) | ||
| + | |||
| + | - Reboot counter (reported to Configed) | ||
| + | |||
| + | - Maximum Reboots (Property) (Prevents continuous loop) | ||