This shows you the differences between two versions of the page.
userspace:windows_updates_-_powershell [2017/03/02 09:39] trabs-ol |
userspace:windows_updates_-_powershell [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | Mit diesem Script werden so lange Updates intstalliert bis keine mehr vorliegen. Die Updates werden nur nach 19 Uhr und vor 7 Uhr installiert um den User nicht an der Anmeldung zu hindern. Aussnahme: Der Rechner wurde neu installiert, | ||
- | Voraussetzungen: | ||
- | |||
- | setup64.ins | ||
- | |||
- | <code winst> | ||
- | ; Copyright (c) uib gmbh (www.uib.de) | ||
- | ; This sourcecode is owned by uib | ||
- | ; and published under the Terms of the General Public License. | ||
- | ; credits: http:// | ||
- | ; comment | ||
- | |||
- | [Actions] | ||
- | requiredWinstVersion >= " | ||
- | AutoActivityDisplay = true | ||
- | StayOnTop = false | ||
- | |||
- | DefVar $LogDir$ | ||
- | DefVar $ProductId$ | ||
- | DefVar $MinimumSpace$ | ||
- | DefVar $ExitCode$ | ||
- | |||
- | DefStringList $Version_List$ | ||
- | DefVar $Version$ | ||
- | |||
- | Set $LogDir$ = " | ||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | ; - Please edit the following values | ||
- | ; ---------------------------------------------------------------- | ||
- | ; | ||
- | ; therefore please: only lower letters, no umlauts, | ||
- | ; no white space use ' | ||
- | Set $ProductId$ | ||
- | Set $MinimumSpace$ | ||
- | ; ---------------------------------------------------------------- | ||
- | |||
- | if not(HasMinimumSpace (" | ||
- | LogError "Not enough space on %SystemDrive%, | ||
- | isFatalError | ||
- | ; Stop process and set installation status to failed | ||
- | else | ||
- | comment "Show product picture" | ||
- | ShowBitmap " | ||
- | |||
- | Message " | ||
- | set $Version_List$ = getOutStreamFromSection (" | ||
- | set $Version$ = takeString(2, | ||
- | |||
- | if ($Version$ < " | ||
- | Message " | ||
- | opsiServiceCall_Powershell_Setup | ||
- | Message " | ||
- | ExitWindows / | ||
- | else | ||
- | Message " | ||
- | endif | ||
- | |||
- | Files_Install /Sysnative | ||
- | Message " | ||
- | DosInAnIcon_WindowsUpate | ||
- | Sub_check_exitcode | ||
- | |||
- | endif | ||
- | |||
- | [DosInAnIcon_PSVersion_check] | ||
- | powershell.exe $PSVersionTable.PSVersion.Major | ||
- | |||
- | [Files_Install] | ||
- | CheckTargetPath = " | ||
- | copy -u " | ||
- | |||
- | [DosInAnIcon_WindowsUpate] | ||
- | " | ||
- | |||
- | [opsiServiceCall_Powershell_Setup] | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | ] | ||
- | |||
- | [Sub_check_exitcode] | ||
- | comment "Test for installation success via exit code" | ||
- | set $ExitCode$ = getLastExitCode | ||
- | ; informations to exit codes see | ||
- | ; http:// | ||
- | ; http:// | ||
- | if ($ExitCode$ = " | ||
- | comment "Looks good: setup program gives exitcode zero" | ||
- | else | ||
- | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
- | if ($ExitCode$ = " | ||
- | comment " | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 1641" | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 3010" | ||
- | comment " | ||
- | ExitWindows / | ||
- | else | ||
- | logError " | ||
- | isFatalError | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | </ | ||
- | |||
- | once64.ins | ||
- | <code winst> | ||
- | ; Copyright (c) uib gmbh (www.uib.de) | ||
- | ; This sourcecode is owned by uib | ||
- | ; and published under the Terms of the General Public License. | ||
- | ; credits: http:// | ||
- | ; comment | ||
- | |||
- | [Actions] | ||
- | requiredWinstVersion >= " | ||
- | AutoActivityDisplay = true | ||
- | StayOnTop = false | ||
- | |||
- | DefVar $LogDir$ | ||
- | DefVar $ProductId$ | ||
- | DefVar $MinimumSpace$ | ||
- | DefVar $ExitCode$ | ||
- | |||
- | DefStringList $Version_List$ | ||
- | DefVar $Version$ | ||
- | |||
- | Set $LogDir$ = " | ||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | ; - Please edit the following values | ||
- | ; ---------------------------------------------------------------- | ||
- | ; | ||
- | ; therefore please: only lower letters, no umlauts, | ||
- | ; no white space use ' | ||
- | Set $ProductId$ | ||
- | Set $MinimumSpace$ | ||
- | ; ---------------------------------------------------------------- | ||
- | |||
- | if not(HasMinimumSpace (" | ||
- | LogError "Not enough space on %SystemDrive%, | ||
- | isFatalError | ||
- | ; Stop process and set installation status to failed | ||
- | else | ||
- | comment "Show product picture" | ||
- | ShowBitmap " | ||
- | |||
- | Message " | ||
- | set $Version_List$ = getOutStreamFromSection (" | ||
- | set $Version$ = takeString(2, | ||
- | |||
- | if ($Version$ < " | ||
- | Message " | ||
- | opsiServiceCall_Powershell_Setup | ||
- | Message " | ||
- | ExitWindows / | ||
- | else | ||
- | Message " | ||
- | endif | ||
- | |||
- | Files_Install /Sysnative | ||
- | Message " | ||
- | DosInAnIcon_WindowsUpate | ||
- | Sub_check_exitcode | ||
- | |||
- | endif | ||
- | |||
- | [DosInAnIcon_PSVersion_check] | ||
- | powershell.exe $PSVersionTable.PSVersion.Major | ||
- | |||
- | [Files_Install] | ||
- | CheckTargetPath = " | ||
- | copy -u " | ||
- | |||
- | [DosInAnIcon_WindowsUpate] | ||
- | " | ||
- | |||
- | [opsiServiceCall_Powershell_Setup] | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | ] | ||
- | |||
- | [Sub_check_exitcode] | ||
- | comment "Test for installation success via exit code" | ||
- | set $ExitCode$ = getLastExitCode | ||
- | ; informations to exit codes see | ||
- | ; http:// | ||
- | ; http:// | ||
- | if ($ExitCode$ = " | ||
- | comment "Looks good: setup program gives exitcode zero" | ||
- | else | ||
- | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
- | if ($ExitCode$ = " | ||
- | comment " | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 1641" | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 3010" | ||
- | comment " | ||
- | ExitWindows / | ||
- | else | ||
- | logError " | ||
- | isFatalError | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | </ | ||
- | |||
- | control | ||
- | |||
- | < | ||
- | [Package] | ||
- | version: 19 | ||
- | depends: | ||
- | incremental: | ||
- | |||
- | [Product] | ||
- | type: localboot | ||
- | id: install-windows-updates | ||
- | name: Updates für Windows installieren | ||
- | description: | ||
- | advice: | ||
- | version: 4.0 | ||
- | priority: -80 | ||
- | licenseRequired: | ||
- | productClasses: | ||
- | setupScript: | ||
- | uninstallScript: | ||
- | updateScript: | ||
- | alwaysScript: | ||
- | onceScript: once64.ins | ||
- | customScript: | ||
- | userLoginScript: | ||
- | |||
- | [ProductDependency] | ||
- | action: setup | ||
- | requiredProduct: | ||
- | requiredStatus: | ||
- | requirementType: | ||
- | </ |