{"id":222697,"date":"2024-03-27T14:41:02","date_gmt":"2024-03-27T14:41:02","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=222697"},"modified":"2024-03-27T14:41:02","modified_gmt":"2024-03-27T14:41:02","slug":"aktualisiere-powershell-zu-5-1","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/aktualisiere-powershell-zu-5-1\/","title":{"rendered":"Ein umfassender Guide: Aktualisieren von PowerShell auf Version 5.1"},"content":{"rendered":"<h2>Die wichtigsten Erkenntnisse<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Automatisiertes PowerShell-Update<\/strong>: Das Skript automatisiert die Aktualisierung von PowerShell auf Version 5.1 unter bestimmten Windows-Versionen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><strong>Effizienz f\u00fcr IT-Fachleute<\/strong>: Ideal f\u00fcr MSPs und IT-Experten, die mehrere Systeme verwalten, um Einheitlichkeit zu gew\u00e4hrleisten und Zeit zu sparen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Kompatibilit\u00e4tspr\u00fcfungen<\/strong>: Pr\u00fcft automatisch die Systemkompatibilit\u00e4t und verhindert die Ausf\u00fchrung auf Systemen, auf denen Exchange Server installiert ist.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><strong>Robuste Fehlerbehandlung<\/strong>: Beinhaltet Fehlerbehandlung und Protokollierung f\u00fcr zuverl\u00e4ssige und nachvollziehbare Aktualisierungen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"5\" data-aria-level=\"1\"><strong>Voraussetzung: Management<\/strong>: Identifiziert und installiert notwendige Voraussetzungen wie .NET Framework-Updates vor der Aktualisierung von PowerShell.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"6\" data-aria-level=\"1\"><strong>Anpassbar und skalierbar<\/strong>: Kann f\u00fcr bestimmte Umgebungen angepasst werden und ist \u00fcber mehrere Systeme hinweg skalierbar.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"7\" data-aria-level=\"1\"><strong>Sicherheitsma\u00dfnahmen<\/strong>: Empfiehlt Tests in kontrollierten Umgebungen und die Erstellung von Sicherungskopien vor dem Einsatz.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"8\" data-aria-level=\"1\"><strong>Erweitert um Management-Tools<\/strong>: In Verbindung mit Tools wie NinjaOne ist eine umfassende Systemverwaltung und -\u00fcberwachung m\u00f6glich.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"9\" data-aria-level=\"1\"><strong>Skript vs. manuelle Aktualisierung<\/strong>: Bietet einen zuverl\u00e4ssigeren und effizienteren Aktualisierungsprozess im Vergleich zu herk\u00f6mmlichen manuellen Methoden.<\/li>\n<\/ul>\n<h2>Hintergrund<\/h2>\n<p>PowerShell ist ein wichtiges Tool in modernen IT-Umgebungen und bietet eine vielseitige Plattform f\u00fcr die Automatisierung von Aufgaben und die Verwaltung von Systemen. Die st\u00e4ndige Aktualisierung von PowerShell ist f\u00fcr die Sicherheit, die Kompatibilit\u00e4t und den Zugriff auf neue Funktionen unerl\u00e4sslich. Dieser Blogbeitrag befasst sich mit einem PowerShell-Skript, das speziell f\u00fcr die Aktualisierung von PowerShell auf Version 5.1 entwickelt wurde, eine Aufgabe, die f\u00fcr viele IT-Experten und <a href=\"https:\/\/www.ninjaone.com\/de\/was-ist-ein-msp\/\">Managed Service Provider (MSPs<\/a>) relevant ist .<\/p>\n<p>Das Skript im Fokus automatisiert das Upgrade von PowerShell auf Version 5.1 auf <a href=\"https:\/\/www.ninjaone.com\/de\/blog\/windows-server-2012-eol-was-sie-wissen-muessen\/\">Windows Server 2012<\/a> R2 und Windows 8.1. Dies ist ein gro\u00dfer Vorteil, da manuelle Aktualisierungen zeitaufw\u00e4ndig und fehleranf\u00e4llig sein k\u00f6nnen. F\u00fcr IT-Experten und MSPs, die mehrere Systeme verwalten, gew\u00e4hrleistet ein solches Skript Konsistenz und Effizienz bei der Wartung ihrer Infrastruktur.<\/p>\n<h2>Das Script:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 2\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Upgrades PowerShell to version 5.1.\r\n.DESCRIPTION\r\n    NOTICE - Multiple reboots may be required to continue with the install in the case\r\n    where 3.0 is installed.\r\n    This requires the user to log back in manually after the reboot before continuing.\r\n\r\n    The script will upgrade powershell to 5.1 on the following OS'\r\n        Windows Server 2012 R2\r\n        Windows 8.1\r\n\r\n    This script WILL NOT run if Exchange Server is installed!\r\n\r\n    A log of this process is created in $env:Temp\\upgrade_powershell.log\r\n    This log can used to see how the script faired after an automatic reboot.\r\n.EXAMPLE\r\n    -Restart\r\nPARAMETER: -Restart\r\n    Restart even if a restart isn't required.\r\n\r\n.EXAMPLE\r\n    # upgrade to 5.1 with defaults and manual login and reboots\r\n    (No Parameters)\r\n\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minium Supported OS: Windows 8.1, Server 2012 R2\r\n    Release Notes: Renamed script and added Script Variable support\r\nBy using this script, you indicate your acceptance of the following legal terms as well as our Terms of Use at https:\/\/www.ninjaone.com\/terms-of-use.\r\n    Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms. \r\n    Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party. \r\n    Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library or website belonging to or under the control of any other software provider. \r\n    Warranty Disclaimer: The script is provided \u201cas is\u201d and \u201cas available\u201d, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations. \r\n    Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks. \r\n    Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script. \r\n    EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).\r\n#&gt;\r\n\r\n[CmdletBinding()]\r\nParam(\r\n    [string]$Version = \"5.1\",\r\n    [switch]$ForceRestart = [System.Convert]::ToBoolean($env:ForceRestart)\r\n)\r\n\r\nbegin {\r\n\r\n    # Modified version from: https:\/\/github.com\/jborean93\/ansible-windows\/tree\/master\/scripts\r\n    #\r\n    # LICENSE: https:\/\/github.com\/jborean93\/ansible-windows\/blob\/master\/LICENSE\r\n    # MIT License\r\n    #\r\n    # Copyright (c) 2017 Jordan Borean\r\n    #\r\n    # Permission is hereby granted, free of charge, to any person obtaining a copy\r\n    # of this software and associated documentation files (the \"Software\"), to deal\r\n    # in the Software without restriction, including without limitation the rights\r\n    # to use, copy, modify, merge, publish, distribute, sublicense, and\/or sell\r\n    # copies of the Software, and to permit persons to whom the Software is\r\n    # furnished to do so, subject to the following conditions:\r\n    #\r\n    # The above copyright notice and this permission notice shall be included in all\r\n    # copies or substantial portions of the Software.\r\n    #\r\n    # THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n    # SOFTWARE.\r\n\r\n\r\n    $ErrorActionPreference = 'Stop'\r\n    if ([System.Management.Automation.ActionPreference]::SilentlyContinue -ne $VerbosePreference) {\r\n        $VerbosePreference = \"Continue\"\r\n    }\r\n\r\n    if ([System.Convert]::ToBoolean($env:Verbose)) {\r\n        $Verbose = $true\r\n    }\r\n\r\n    # Don't upgrade PowerShell if Exchange is installed, this needs manual intervention to not cause problems.\r\n    if ($(Get-Service -Name MSExchangeServiceHost -ErrorAction SilentlyContinue) -or $(Get-Command Exsetup.exe -ErrorAction SilentlyContinue | ForEach-Object { $_.FileVersionInfo })) {\r\n        Write-Host \"Exchange looks to be installed. Aborting PowerShell upgrade.\"\r\n        exit 1\r\n    }\r\n\r\n    [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }\r\n\r\n    $tmp_dir = $env:temp\r\n    if (-not (Test-Path -Path $tmp_dir)) {\r\n        New-Item -Path $tmp_dir -ItemType Directory &gt; $null\r\n    }\r\n\r\n    Function Write-Log($message, $level = \"INFO\") {\r\n        # Poor man's implementation of Log4Net\r\n        $date_stamp = Get-Date -Format s\r\n        $log_entry = \"$date_stamp - $level - $message\"\r\n        $log_file = \"$tmp_dir\\upgrade_powershell.log\"\r\n        Write-Host -Message $log_entry\r\n        Add-Content -Path $log_file -Value $log_entry\r\n    }\r\n\r\n    Function Invoke-Reboot {\r\n\r\n        Write-Log -message \"need to reboot server to continue powershell upgrade\"\r\n\r\n        shutdown.exe \/r \/t 30\r\n    }\r\n\r\n    Function Invoke-RunProcess($executable, $arguments) {\r\n        $process = New-Object -TypeName System.Diagnostics.Process\r\n        $psi = $process.StartInfo\r\n        $psi.FileName = $executable\r\n        $psi.Arguments = $arguments\r\n        Write-Log -message \"starting new process '$executable $arguments'\"\r\n        $process.Start() | Out-Null\r\n    \r\n        $process.WaitForExit() | Out-Null\r\n        $exit_code = $process.ExitCode\r\n        Write-Log -message \"process completed with exit code '$exit_code'\"\r\n\r\n        return $exit_code\r\n    }\r\n\r\n    Function Invoke-DownloadFile($url, $path) {\r\n        Write-Log -message \"downloading url '$url' to '$path'\"\r\n        $client = New-Object -TypeName System.Net.WebClient\r\n        $client.DownloadFile($url, $path)\r\n    }\r\n\r\n    Write-Log -message \"starting script\"\r\n    # on PS v1.0, upgrade to 2.0 and then run the script again\r\n    if ($PSVersionTable -eq $null) {\r\n        Write-Log -message \"upgrading powershell v1.0 to v2.0\"\r\n        $architecture = $env:PROCESSOR_ARCHITECTURE\r\n        if ($architecture -eq \"AMD64\") {\r\n            $url = \"https:\/\/download.microsoft.com\/download\/2\/8\/6\/28686477-3242-4E96-9009-30B16BED89AF\/Windows6.0-KB968930-x64.msu\"\r\n        }\r\n        else {\r\n            $url = \"https:\/\/download.microsoft.com\/download\/F\/9\/E\/F9EF6ACB-2BA8-4845-9C10-85FC4A69B207\/Windows6.0-KB968930-x86.msu\"\r\n        }\r\n        $filename = $url.Split(\"\/\")[-1]\r\n        $file = \"$tmp_dir\\$filename\"\r\n        Invoke-DownloadFile -url $url -path $file\r\n        $exit_code = Invoke-RunProcess -executable $file -arguments \"\/quiet \/norestart\"\r\n        if ($exit_code -ne 0 -and $exit_code -ne 3010) {\r\n            $error_msg = \"failed to update Powershell from 1.0 to 2.0: exit code $exit_code\"\r\n            Write-Log -message $error_msg -level \"ERROR\"\r\n            throw $error_msg\r\n        }\r\n        Invoke-Reboot\r\n    }\r\n\r\n    # exit if the target version is the same as the actual version\r\n    $current_ps_version = [version]\"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)\"\r\n    if ($current_ps_version -eq [version]$Version) {\r\n        Write-Log -message \"current and target PS version are the same, no action is required\"\r\n        exit 0\r\n    }\r\n\r\n    $os_version = [Version](Get-Item -Path \"$env:SystemRoot\\System32\\kernel32.dll\").VersionInfo.ProductVersion\r\n    $architecture = $env:PROCESSOR_ARCHITECTURE\r\n    if ($architecture -eq \"AMD64\") {\r\n        $architecture = \"x64\"\r\n    }\r\n    else {\r\n        $architecture = \"x86\"\r\n    }\r\n}\r\n\r\nprocess {\r\n    $actions = @()\r\n    switch ($Version) {\r\n        \"5.1\" {\r\n            if ($os_version -lt [version]\"6.3\") {\r\n                $error_msg = \"cannot upgrade Server 2008 to Powershell v5.1, v3 is the latest supported\"\r\n                Write-Log -message $error_msg -level \"ERROR\"\r\n                throw $error_msg\r\n            }\r\n            # check if WMF 3 is installed, need to be uninstalled before 5.1\r\n            if ($os_version.Minor -lt 2) {\r\n                $wmf3_installed = Get-HotFix -Id \"KB2506143\" -ErrorAction SilentlyContinue\r\n                if ($wmf3_installed) {\r\n                    $error_msg = \"cannot upgrade to Powershell v5.1, this needs manual intervention.\"\r\n                    Write-Log -message $error_msg -level \"ERROR\"\r\n                    throw $error_msg\r\n                }\r\n            }\r\n            $actions += \"5.1\"\r\n            break\r\n        }\r\n        default {\r\n            $error_msg = \"version '$Version' is not supported in this upgrade script\"\r\n            Write-Log -message $error_msg -level \"ERROR\"\r\n            throw $error_msg\r\n        }\r\n    }\r\n\r\n    # detect if .NET 4.5.2 is not installed and add to the actions\r\n    $dotnet_path = \"HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\"\r\n    if (-not $(Test-Path -Path $dotnet_path -ErrorAction SilentlyContinue)) {\r\n        $dotnet_upgrade_needed = $true\r\n    }\r\n    else {\r\n        $dotnet_version = Get-ItemProperty -Path $dotnet_path -Name Release -ErrorAction SilentlyContinue\r\n        if ($dotnet_version) {\r\n            # 379893 == 4.5.2\r\n            if ($dotnet_version.Release -lt 379893) {\r\n                $dotnet_upgrade_needed = $true\r\n            }        \r\n        }\r\n        else {\r\n            $dotnet_upgrade_needed = $true\r\n        }\r\n    }\r\n    if ($dotnet_upgrade_needed) {\r\n        $actions = @(\"dotnet\") + $actions\r\n    }\r\n\r\n    Write-Log -message \"The following actions will be performed: $($actions -join \", \")\"\r\n    foreach ($action in $actions) {\r\n        $url = $null\r\n        $file = $null\r\n        $arguments = \"\/quiet \/norestart\"\r\n\r\n        switch ($action) {\r\n            \"dotnet\" {\r\n                Write-Log -message \"running .NET update to 4.5.2\"\r\n                $url = \"https:\/\/download.microsoft.com\/download\/E\/2\/1\/E21644B5-2DF2-47C2-91BD-63C560427900\/NDP452-KB2901907-x86-x64-AllOS-ENU.exe\"\r\n                $error_msg = \"failed to update .NET to 4.5.2\"\r\n                $arguments = \"\/q \/norestart\"\r\n                break\r\n            }\r\n            \"5.1\" {\r\n                Write-Log -message \"running powershell update to version 5.1\"\r\n                if ($os_version.Minor -eq 2) {\r\n                    # Server 2012\r\n                    $url = \"http:\/\/download.microsoft.com\/download\/6\/F\/5\/6F5FF66C-6775-42B0-86C4-47D41F2DA187\/W2K12-KB3191565-x64.msu\"\r\n                }\r\n                else {\r\n                    # Server 2012 R2 and Windows 8.1\r\n                    if ($architecture -eq \"x64\") {\r\n                        $url = \"http:\/\/download.microsoft.com\/download\/6\/F\/5\/6F5FF66C-6775-42B0-86C4-47D41F2DA187\/Win8.1AndW2K12R2-KB3191564-x64.msu\"\r\n                    }\r\n                    else {\r\n                        $url = \"http:\/\/download.microsoft.com\/download\/6\/F\/5\/6F5FF66C-6775-42B0-86C4-47D41F2DA187\/Win8.1-KB3191564-x86.msu\"\r\n                    }\r\n                }\r\n                break\r\n            }\r\n            default {\r\n                $error_msg = \"unknown action '$action'\"\r\n                Write-Log -message $error_msg -level \"ERROR\"\r\n            }\r\n        }\r\n\r\n        if ($null -eq $file) {\r\n            $filename = $url.Split(\"\/\")[-1]\r\n            $file = \"$tmp_dir\\$filename\"\r\n        }\r\n        if ($null -ne $url) {\r\n            Invoke-DownloadFile -url $url -path $file\r\n        }\r\n    \r\n        $exit_code = Invoke-RunProcess -executable $file -arguments $arguments\r\n        if ($exit_code -ne 0 -and $exit_code -ne 3010) {\r\n            $log_msg = \"$($error_msg): exit code $exit_code\"\r\n            Write-Log -message $log_msg -level \"ERROR\"\r\n            throw $log_msg\r\n        }\r\n        if ($exit_code -eq 3010) {\r\n            $log_msg = \"Reboot is required!\"\r\n            Write-Log -message $log_msg -level \"WARN\"\r\n            break\r\n        }\r\n    }\r\n    if ($ForceRestart) {\r\n        Invoke-Reboot\r\n    }\r\n}\r\nend {\r\n    \r\n    \r\n    \r\n}<\/pre>\n<p>&nbsp;<\/p>\n\n<div class=\"in-context-cta\"><p>Zugriff auf \u00fcber 300 Skripte im NinjaOne Dojo<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/freetrialform\/\">Zugang erhalten<\/a><\/p>\n<\/div>\n<h2>Detaillierte Aufschl\u00fcsselung<\/h2>\n<p>Das Skript arbeitet in mehreren Stufen:<\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Vorbereitung und \u00dcberpr\u00fcfung<\/strong>: Zun\u00e4chst werden die Einstellungen f\u00fcr die Fehlerbehandlung festgelegt und das Vorhandensein von Microsoft Exchange Server \u00fcberpr\u00fcft, da dessen Vorhandensein einen anderen Aktualisierungsansatz erfordert.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><strong>Erste Aufzeichnung<\/strong>: Anschlie\u00dfend initialisiert es die Protokollierung, um den Fortschritt des Skripts zu verfolgen, was besonders in Umgebungen n\u00fctzlich ist, in denen automatisierte Aufgaben h\u00e4ufig ausgef\u00fchrt werden.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>PowerShell-Versionspr\u00fcfung<\/strong>: Das Skript \u00fcberpr\u00fcft die aktuelle PowerShell-Version. Wenn es bereits 5.1 ist, wird das Skript beendet, da keine Aktualisierung erforderlich ist.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><strong>\u00dcberpr\u00fcfung von Betriebssystem und Architektur<\/strong>: Es identifiziert das Betriebssystem und die Architektur (x64 oder x86), um das richtige Update-Paket zu ermitteln.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"5\" data-aria-level=\"1\"><strong>Aktionsbestimmung<\/strong>: Das Skript entscheidet, ob <a href=\"https:\/\/www.ninjaone.com\/de\/script-hub\/installation-von-net-framework-4-powershell\/\">.NET Framework<\/a> vor PowerShell aktualisiert werden soll, eine Voraussetzung f\u00fcr PowerShell 5.1.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"6\" data-aria-level=\"1\"><strong>Herunterladen und Installieren von Updates<\/strong>: Anschlie\u00dfend l\u00e4dt er die erforderlichen Pakete herunter und installiert sie, wobei er bei Bedarf einen Neustart durchf\u00fchrt.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"7\" data-aria-level=\"1\"><strong>Option Neustart erzwingen<\/strong>: Ein Parameter erm\u00f6glicht bei Bedarf einen erzwungenen Neustart, um sicherzustellen, dass die Aktualisierungen vollst\u00e4ndig \u00fcbernommen werden.<\/li>\n<\/ul>\n<h2>M\u00f6gliche Anwendungsf\u00e4lle<\/h2>\n<p>Stellen Sie sich einen MSP vor, der f\u00fcr die Wartung mehrerer Kundenumgebungen verantwortlich ist. Sie k\u00f6nnen dieses Skript auf verschiedenen Systemen bereitstellen und sicherstellen, dass alle auf dieselbe PowerShell-Version aktualisiert werden. Diese Einheitlichkeit vereinfacht die Verwaltung und verringert Kompatibilit\u00e4tsprobleme.<\/p>\n<h2>Vergleiche<\/h2>\n<p>Traditionell k\u00f6nnen PowerShell-Aktualisierungen manuell oder \u00fcber ein Batch-Skript durchgef\u00fchrt werden. Dieses PowerShell-Skript bietet einen ausgefeilteren Ansatz mit Fehlerbehandlung, Protokollierung und Umgebungspr\u00fcfungen, wodurch das Risiko von Unterbrechungen oder Ausf\u00e4llen verringert wird.<\/p>\n<h2>FAQs<\/h2>\n<p><strong>F: Funktioniert dieses Skript unter jedem Windows-Betriebssystem?<\/strong><br \/>\nA: Nein, es ist f\u00fcr Windows Server 2012 R2 und Windows 8.1 konzipiert.<\/p>\n<p><strong>F: Was ist, wenn Microsoft Exchange Server installiert ist?<\/strong><br \/>\nA: Das Skript f\u00e4hrt nicht mit der Aktualisierung fort, da Exchange Server einen anderen Aktualisierungsprozess erfordert.<\/p>\n<p><strong>F: Kann ich dieses Skript verwenden, um auf andere Versionen als 5.1 zu aktualisieren?<\/strong><br \/>\nA: Das aktuelle Skript ist speziell f\u00fcr die Aktualisierung auf PowerShell 5.1 gedacht. F\u00fcr andere Versionen m\u00fcssten \u00c4nderungen vorgenommen werden.<\/p>\n<h2>Auswirkungen<\/h2>\n<p>Die Verwendung dieses Skripts kann die<a href=\"https:\/\/www.ninjaone.com\/de\/effizienz\/\"> IT-Effizienz<\/a> erheblich verbessern, muss aber sorgf\u00e4ltig bedacht werden. Eine fehlerhafte Aktualisierung kann zu einer Instabilit\u00e4t des Systems f\u00fchren. Testen Sie immer in einer kontrollierten Umgebung, bevor Sie die Software in gro\u00dfem Umfang einsetzen.<\/p>\n<h2>Empfehlungen<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><strong>Zuerst testen<\/strong>: F\u00fchren Sie das Skript immer in einer Testumgebung aus, bevor Sie es breit einsetzen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"2\" data-aria-level=\"1\"><strong>Sicherungssysteme<\/strong>: Stellen Sie sicher, dass die Systemsicherungen f\u00fcr den Fall eines Ausfalls aktuell sind.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"3\" data-aria-level=\"1\"><strong>Anpassen nach Bedarf<\/strong>: \u00c4ndern Sie das Skript bei Bedarf f\u00fcr bestimmte Umgebungen.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"4\" data-aria-level=\"1\"><strong>Protokolle \u00fcberwachen<\/strong>: \u00dcberpr\u00fcfen Sie die erstellten Protokolle regelm\u00e4\u00dfig auf Probleme oder Anomalien.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Im Rahmen eines optimierten IT-Managements k\u00f6nnen Werkzeuge wie NinjaOne solche Skripte erg\u00e4nzen, indem sie eine <a href=\"https:\/\/www.ninjaone.com\/de\/\">zentrale Steuerung und \u00dcberwachung<\/a>bieten . NinjaOnes Funktionen zur Verwaltung von Updates und zur \u00dcberwachung des Systemzustands k\u00f6nnen mit solchen Skripten kombiniert werden, um die IT-Effizienz und -Zuverl\u00e4ssigkeit insgesamt zu verbessern. Die Kombination aus <a href=\"https:\/\/www.ninjaone.com\/script-hub\/\">Automatisierung durch Skripte<\/a> und einem robusten Management-Tool wie NinjaOne stellt sicher, dass IT-Umgebungen nicht nur aktualisiert, sondern auch konsequent \u00fcberwacht und verwaltet werden, um Spitzenleistungen zu erzielen.<\/p>\n","protected":false},"author":35,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","_lmt_disableupdate":"no","_lmt_disable":""},"operating_system":[4212],"use_cases":[4385],"class_list":["post-222697","script_hub","type-script_hub","status-publish","hentry","script_hub_category-windows","use_cases-software-upgrade"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/222697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/comments?post=222697"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=222697"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=222697"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=222697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}