{"id":208588,"date":"1970-01-01T00:00:00","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=208588"},"modified":"2024-03-04T19:03:44","modified_gmt":"2024-03-04T19:03:44","slug":"windows-minidumps-aktivieren-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/windows-minidumps-aktivieren-powershell\/","title":{"rendered":"Aktivieren von Minidumps unter Windows mit PowerShell"},"content":{"rendered":"<p>F\u00fcr die Fehlersuche und -behebung in Computersystemen werden h\u00e4ufig spezielle Tools und Skripte ben\u00f6tigt. Eine solche Methode, die f\u00fcr viele IT-Experten entscheidend ist, ist die Verwendung von Minidump-Dateien. Diese Dateien bieten eine Momentaufnahme des aktiven Speichers, wenn ein Computer abst\u00fcrzt, und liefern unsch\u00e4tzbare Daten f\u00fcr die Analyse nach dem Absturz. In diesem Artikel wird ein <strong>PowerShell-Skript vorgestellt , mit dem die Aktivierung von Minidumps auf Windows-Systemen automatisiert werden kann<\/strong>.<\/p>\n<h2>Hintergrund<\/h2>\n<p>F\u00fcr IT-Fachleute und Managed Service Provider (MSPs) ist die F\u00e4higkeit, Daten \u00fcber Abst\u00fcrze zu erfassen und zu analysieren, von entscheidender Bedeutung. Auf diese Weise k\u00f6nnen sie die Gr\u00fcnde f\u00fcr einen Systemabsturz besser nachvollziehen und zuk\u00fcnftige Vorf\u00e4lle verhindern. Vor allem<a href=\"https:\/\/www.ninjaone.com\/blog\/what-is-a-windows-minidump-file\/\">Minidump-Dateien<\/a> liefern ausreichend Daten, ohne viel Speicherplatz zu verbrauchen, weshalb sie von vielen Experten bevorzugt werden. Die manuelle Einrichtung der Minidump-Erzeugung kann jedoch m\u00fchsam sein, so dass hier eine Automatisierung ins Spiel kommt. Mit Hilfe von Skripten wie dem hier vorgestellten k\u00f6nnen Fachleute ihre Systeme effizient so einrichten, dass sie bei Bedarf Minidumps erzeugen.<\/p>\n<h2>Das Skript<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">&lt;#\r\n.SYNOPSIS\r\n    Turn on mini dumps if they are off, if other dumps are already enabled do not change the configuration.\r\n.DESCRIPTION\r\n    Turn on mini dumps if they are off, if other dumps are already enabled do not change the configuration.\r\n    This will enable the creation of the pagefile, but set to automatically manage by Windows.\r\n    Reboot might be needed.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Windows Server 2016\r\n    Release Notes:\r\n    Initial Release\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[CmdletBinding()]\r\nparam ()\r\n\r\nbegin {\r\n    function Set-ItemProp {\r\n        param (\r\n            $Path,\r\n            $Name,\r\n            $Value,\r\n            [ValidateSet(\"DWord\", \"QWord\", \"String\", \"ExpandedString\", \"Binary\", \"MultiString\", \"Unknown\")]\r\n            $PropertyType = \"DWord\"\r\n        )\r\n        # Do not output errors and continue\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue\r\n        if (-not $(Test-Path -Path $Path)) {\r\n            # Check if path does not exist and create the path\r\n            New-Item -Path $Path -Force | Out-Null\r\n        }\r\n        if ((Get-ItemProperty -Path $Path -Name $Name)) {\r\n            # Update property and print out what it was changed from and changed to\r\n            $CurrentValue = Get-ItemProperty -Path $Path -Name $Name\r\n            try {\r\n                Set-ItemProperty -Path $Path -Name $Name -Value $Value -Force -Confirm:$false -ErrorAction Stop | Out-Null\r\n            }\r\n            catch {\r\n                Write-Error $_\r\n            }\r\n            Write-Host \"$Path$Name changed from $CurrentValue to $(Get-ItemProperty -Path $Path -Name $Name)\"\r\n        }\r\n        else {\r\n            # Create property with value\r\n            try {\r\n                New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $PropertyType -Force -Confirm:$false -ErrorAction Stop | Out-Null\r\n            }\r\n            catch {\r\n                Write-Error $_\r\n            }\r\n            Write-Host \"Set $Path$Name to $(Get-ItemProperty -Path $Path -Name $Name)\"\r\n        }\r\n        $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue\r\n    }\r\n    function Test-IsElevated {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        $p = New-Object System.Security.Principal.WindowsPrincipal($id)\r\n        $p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)\r\n    }\r\n}\r\nprocess {\r\n    if (-not (Test-IsElevated)) {\r\n        Write-Error -Message \"Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n\r\n    # Reference: https:\/\/learn.microsoft.com\/en-US\/troubleshoot\/windows-server\/performance\/memory-dump-file-options\r\n    $Path = \"HKLM:SystemCurrentControlSetControlCrashControl\"\r\n    $Name = \"CrashDumpEnabled\"\r\n    $CurrentValue = Get-ItemPropertyValue -Path $Path -Name $Name -ErrorAction SilentlyContinue\r\n    $Value = 3\r\n\r\n    # If CrashDumpEnabled is set to 0 or doesn't exist then enable mini crash dump\r\n    if ($CurrentValue -eq 0 -and $null -ne $CurrentValue) {\r\n        $PageFile = Get-ItemPropertyValue -Path \"HKLM:SYSTEMCurrentControlSetControlSession ManagerMemory Management\" -Name PagingFiles -ErrorAction SilentlyContinue\r\n        if (-not $PageFile) {\r\n            # If the pagefile was not setup, create the registry entry needed to create the pagefile\r\n            try {\r\n                # Enable automatic page management file if disabled to allow mini dump to function\r\n                Set-ItemProp -Path \"HKLM:SYSTEMCurrentControlSetControlSession ManagerMemory Management\" -Name PagingFiles -Value \"?:pagefile.sys\" -PropertyType MultiString\r\n            }\r\n            catch {\r\n                Write-Error \"Could not create pagefile.\"\r\n                exit 1\r\n            }\r\n        }\r\n        Set-ItemProp -Path $Path -Name $Name -Value 3\r\n        Write-Host \"Reboot might be needed to enable mini crash dump.\"\r\n    }\r\n    else {\r\n        Write-Host \"Crash dumps are already enabled.\"\r\n    }\r\n    exit 0\r\n}\r\nend {}<\/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>Detailansicht<\/h2>\n<p>Das vorgestellte PowerShell-Skript beginnt mit der \u00dcberpr\u00fcfung, ob das System \u00fcber Administratorrechte verf\u00fcgt. Dies ist wichtig, da \u00c4nderungen an der Systemregistrierung, wie sie von diesem Skript beabsichtigt sind, solche Berechtigungen erfordern.<\/p>\n<p>Der wichtigste Registrierungspfad von Interesse ist <strong>HKLM:SystemCurrentControlSetControlCrashControl<\/strong>. Innerhalb dieses Pfads gibt es einen speziellen Registrierungsschl\u00fcssel, <strong>CrashDumpEnabled<\/strong>, der den Status der Crash-Dump-Erzeugung steuert.<\/p>\n<p>Wenn dieser Schl\u00fcssel auf <strong>0<\/strong> gesetzt ist oder nicht existiert, bedeutet dies, dass Crash-Dumps nicht aktiviert sind. Das Skript wird dann Schritte unternehmen, um die Erstellung von Minidumps zu aktivieren. Au\u00dferdem pr\u00fcft das Skript, ob eine Auslagerungsdatei vorhanden ist, und erstellt eine solche, falls sie fehlt, da dies eine Voraussetzung f\u00fcr die Erstellung von Minidumps ist.<\/p>\n<h2>Potenzielle Anwendungsf\u00e4lle<\/h2>\n<p>Stellen Sie sich einen IT-Fachmann, Robert, vor, der in einem mittelgro\u00dfen Unternehmen arbeitet. Nach mehreren unerkl\u00e4rlichen Systemabst\u00fcrzen steht Robert unter Druck, die Ursache herauszufinden. Anstatt Maschine f\u00fcr Maschine vorzugehen, setzt Robert\u00a0dieses Skript auf allen Computern im Unternehmen ein. Dieser proaktive Ansatz stellt sicher, dass Robert beim n\u00e4chsten Absturz eine Minidump-Datei f\u00fcr die Analyse zur Verf\u00fcgung hat. Gute Arbeit, Robert!<\/p>\n<h2>Alternative Herangehensweise<\/h2>\n<p>Um die Minidump-Generierung zu aktivieren, muss man normalerweise durch mehrere Windows-Men\u00fcs navigieren oder die Registrierung manuell bearbeiten &#8211; beides zeitaufw\u00e4ndige und fehleranf\u00e4llige Aufgaben. Dieses Skript zeichnet sich dadurch aus, dass es den Prozess automatisiert und so die Gefahr menschlicher Fehler verringert und eine konsistente Einrichtung \u00fcber mehrere Rechner hinweg gew\u00e4hrleistet.<\/p>\n<h2>FAQs<\/h2>\n<ul>\n<li>Was sind die Voraussetzungen f\u00fcr die Verwendung dieses Skripts?<br \/>\nDas Skript unterst\u00fctzt Windows 10 und Windows Server 2016 oder neuere Versionen.<\/li>\n<li>Ist nach der Ausf\u00fchrung des Skripts ein Neustart erforderlich?<br \/>\nEin Neustart kann erforderlich sein, um die Aktivierung von Mini-Crash-Dumps abzuschlie\u00dfen.<\/li>\n<li>Was ist, wenn auf meinem System bereits Crash-Dumps aktiviert sind?<br \/>\nDas Skript erkennt dies und nimmt keine \u00c4nderungen vor.<\/li>\n<\/ul>\n<h2>Auswirkungen<\/h2>\n<p>Die Aktivierung der Minidump-Erstellung ist ein zweischneidiges Schwert. Sie bieten zwar wertvolle Daten f\u00fcr die Fehlersuche, k\u00f6nnen aber auch sensible Informationen enthalten. IT-Experten sollten in Erw\u00e4gung ziehen, diese Dateien zu verschl\u00fcsseln oder sicherzustellen, dass sie an sicheren Orten gespeichert werden.<\/p>\n<h2>Empfehlungen<\/h2>\n<ul>\n<li>Testen Sie das Skript immer in einer kontrollierten Umgebung, bevor Sie es einsetzen.<\/li>\n<li>Pr\u00fcfen und l\u00f6schen Sie Minidump-Dateien regelm\u00e4\u00dfig, um Speicherplatz zu sparen und den Datenschutz zu wahren.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Die Einf\u00fchrung automatisierter L\u00f6sungen, wie das besprochene Skript, vereinfacht die <a href=\"https:\/\/www.ninjaone.com\/de\/ticketing-software\/\">IT-Verwaltungsaufgaben<\/a>. Plattformen wie NinjaOne bieten eine zentrale Kontrolle und eine Reihe von Tools, die auf die Bed\u00fcrfnisse von IT-Fachleuten zugeschnitten sind und sicherstellen, dass die Systeme optimiert und sicher bleiben.<\/p>\n","protected":false},"author":35,"featured_media":207149,"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":[4280],"class_list":["post-208588","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/208588","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=208588"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media\/207149"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=208588"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=208588"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=208588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}