{"id":257377,"date":"2024-05-21T14:32:32","date_gmt":"2024-05-21T14:32:32","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=257377"},"modified":"2024-05-21T14:34:10","modified_gmt":"2024-05-21T14:34:10","slug":"hyper-v-replication-monitoring","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/de\/script-hub\/hyper-v-replication-monitoring\/","title":{"rendered":"Optimieren Sie Ihr IT-Management: Meisterung des Hyper-V-Replikations-Monitoring mit PowerShell"},"content":{"rendered":"<h2>Haupterkenntnisse<\/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 Hyper-V-Replikations-Monitoring<\/strong>: Das Skript automatisiert den Prozess der \u00dcberwachung des Hyper-V-Replikationsstatus und verbessert die Effizienz im Management von virtuellen 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=\"2\" data-aria-level=\"1\"><strong>Anpassbare Alarm-Schwellenwerte<\/strong>: Administratoren k\u00f6nnen benutzerdefinierte Schwellenwerte f\u00fcr Replikationswarnungen mithilfe von Parametern wie &#8211;<strong>FailedFor festlegen<\/strong>.<\/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>Erh\u00f6hte Berechtigungen erforderlich<\/strong>: Die Ausf\u00fchrung des Skripts erfordert Administratorrechte f\u00fcr den Zugriff auf detaillierte VM-Replikationsinformationen.<\/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>Umgebungsspezifische Anpassungen<\/strong>: Verwenden Sie Umgebungsvariablen und benutzerdefinierte Felder, um die Funktionalit\u00e4t des Skripts an bestimmte IT-Umgebungen anzupassen.<\/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>Proaktives IT-Management-Tool<\/strong>: Das Skript dient als proaktives Tool f\u00fcr IT-Fachleute, das die rechtzeitige Erkennung und L\u00f6sung von Replikationsproblemen gew\u00e4hrleistet.<\/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>Verbessert gegen\u00fcber manuellen Methoden<\/strong>: Bietet einen umfassenderen und automatisierten Ansatz im Vergleich zu manuellen Kontrollen oder einfachen Skripten.<\/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>Integraler Bestandteil des <a href=\"https:\/\/www.ninjaone.com\/de\/it-management-fuer-unternehmen\/infrastruktur\/\">IT-Infrastrukturmanagements<\/a><\/strong>: In Verbindung mit Plattformen wie NinjaOne bietet das Skript einen erheblichen Mehrwert f\u00fcr die Verwaltung und Sicherung der IT-Infrastruktur.<\/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>Erfordert <a href=\"https:\/\/www.ninjaone.com\/de\/script-hub\/aktualisiere-powershell-zu-5-1\/\">PowerShell 5.1<\/a> oder eine neuere Version<\/strong>: Stellen Sie die Kompatibilit\u00e4t und Funktionalit\u00e4t mit der entsprechenden Version von PowerShell sicher.<\/li>\n<\/ul>\n<p>Die effektive Verwaltung virtueller Umgebungen ist f\u00fcr IT-Experten von entscheidender Bedeutung, um optimale Leistung und Sicherheit zu gew\u00e4hrleisten. Ein wichtiger Aspekt dabei ist die \u00dcberwachung und Verwaltung der <a href=\"https:\/\/www.ninjaone.com\/blog\/what-is-hyper-v-key-features-and-capabilities\/\">Hyper-V-Replikation<\/a>, einer Funktion, die in virtualisierten Netzwerken zu Redundanz- und Failover-Zwecken weit verbreitet ist. Eine effiziente \u00dcberwachung des Hyper-V-Replikationsstatus gew\u00e4hrleistet die Gesch\u00e4ftskontinuit\u00e4t und Datenintegrit\u00e4t im Falle unerwarteter Ausf\u00e4lle.<\/p>\n<h2>Hintergrund<\/h2>\n<p>Die Hyper-V-Replikation ist ein Mechanismus, mit dem <a href=\"https:\/\/www.ninjaone.com\/de\/endpoint-management\/ueberwachung-virtueller-maschinen\/\">virtuelle Maschinen (VMs<\/a> ) von einem Hyper-V-Host auf einen anderen repliziert werden k\u00f6nnen, was eine wichtige L\u00f6sung f\u00fcr die Notfallwiederherstellung darstellt. IT-Experten und <a href=\"https:\/\/www.ninjaone.com\/what-is-an-msp\/\">Managed Service Provider (MSPs<\/a> ) ben\u00f6tigen robuste Tools zur \u00dcberwachung dieses Replikationsprozesses. Das Skript, \u00fcber das wir sprechen, dient genau diesem Zweck: Es erm\u00f6glicht Administratoren, den Zustand und Status von VM-Replikationen effizient zu verfolgen und schnell auf Anomalien zu reagieren.<\/p>\n<h2>Das Skript:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 5.1\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    This will get information about the current status of Hyper-V Replication. If its abnormal it'll check the last replication time to see if it should alert on it.\r\n.DESCRIPTION\r\n    This will get information about the current status of Hyper-V Replication. If its abnormal it'll check the last replication time to see if it should alert on it.\r\n.EXAMPLE \r\n    (No Parameters)\r\n    Replication is currently failing!\r\n    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep \r\n   tion\r\n    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio \r\n   n,customscript_gen_2.ps1\r\n \r\n\r\n    VMName      PrimaryServer            State   Health LastReplicationTime \r\n    ------      -------------            -----   ------ ------------------- \r\n    WIN10-TEST  SRV16-TEST.test.lan      Error Critical 4\/13\/2023 8:20:11 AM\r\n    Win10-TEST2 SRV16-TEST.test.lan      Error Critical 4\/13\/2023 8:20:11 AM\r\n\r\nPARAMETER: -FailedFor \"30\"\r\n    Time in minutes any given vm replication is allowed to be abnormal.\r\n    Ex. \"20\" will alert on a vm replication after its been in the abnormal state for 20 minutes.\r\n.EXAMPLE\r\n    -FailedFor \"20\"\r\n    WARNING: Some of the vm's currently have replication paused!\r\n \r\n\r\n    VMName      PrimaryServer                  State  Health LastReplicationTime \r\n    ------      -------------                  -----  ------ ------------------- \r\n    WIN10-TEST  SRV16-TEST.test.lan      Replicating  Normal 4\/13\/2023 8:40:04 AM\r\n    Win10-TEST2 SRV16-TEST.test.lan        Suspended Warning 4\/13\/2023 8:32:06 AM\r\n\r\nPARAMETER: -IncludePaused\r\n    Script will consider paused vm's abnormal if this parameter is used.    \r\n.EXAMPLE\r\n    -IncludePaused\r\n    Replication is currently failing!\r\n    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep \r\n   tion\r\n    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio \r\n   n,customscript_gen_2.ps1\r\n \r\n\r\n    VMName      PrimaryServer                  State  Health LastReplicationTime \r\n    ------      -------------                  -----  ------ ------------------- \r\n    WIN10-TEST  SRV16-TEST.test.lan      Replicating  Normal 4\/13\/2023 8:40:04 AM\r\n    Win10-TEST2 SRV16-TEST.test.lan        Suspended Warning 4\/13\/2023 8:32:06 AM\r\n\r\nPARAMETER: -FromCustomField \"ReplaceMeWithAnyIntegerCustomField\"\r\n    Name of an integer custom field that contains your desired FailedFor threshold.\r\n    ex. \"ReplicationAlertThreshold\" where you have entered in your desired alert limit in the \"ReplicationAlertThreshold\" custom field rather than in a parameter.\r\n.EXAMPLE\r\n    -FromCustomField \"ReplaceMeWithAnyIntegerCustomField\"\r\n    WARNING: Some of the vm's currently have replication paused!\r\n \r\n\r\n    VMName      PrimaryServer                  State  Health LastReplicationTime \r\n    ------      -------------                  -----  ------ ------------------- \r\n    WIN10-TEST  SRV16-TEST.test.lan      Replicating  Normal 4\/13\/2023 8:40:04 AM\r\n    Win10-TEST2 SRV16-TEST.test.lan        Suspended Warning 4\/13\/2023 8:32:06 AM\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 10, Server 2016\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    [Parameter()]\r\n    [int]$FailedFor = \"60\",\r\n    [Parameter()]\r\n    [String]$FromCustomField,\r\n    [Parameter()]\r\n    [Switch]$IncludePaused = [System.Convert]::ToBoolean($env:includePausedReplications)\r\n)\r\nbegin {\r\n\r\n    if ($env:allowedToFailForxMinutes -and $env:allowedToFailForxMinutes -notlike \"null\") { $FailedFor = $env:allowedToFailForxMinutes }\r\n    if ($env:retrieveAllowedFailureTimeFromCustomField -and $env:retrieveAllowedFailureTimeFromCustomField -notlike \"null\" ) { $FromCustomField = $env:retrieveAllowedFailureTimeFromCustomField }\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\n    function Test-IsSystem {\r\n        $id = [System.Security.Principal.WindowsIdentity]::GetCurrent()\r\n        return $id.Name -like \"NT AUTHORITY*\" -or $id.IsSystem\r\n    }\r\n\r\n    if (!(Test-IsElevated) -and !(Test-IsSystem)) {\r\n        Write-Error -Message \"Access Denied. Please run with Administrator privileges.\"\r\n        exit 1\r\n    }\r\n\r\n    # This function is to make it easier to parse Ninja Custom Fields.\r\n    function Get-NinjaProperty {\r\n        [CmdletBinding()]\r\n        Param(\r\n            [Parameter(Mandatory = $True, ValueFromPipeline = $True)]\r\n            [String]$Name,\r\n            [Parameter()]\r\n            [String]$Type,\r\n            [Parameter()]\r\n            [String]$DocumentName\r\n        )\r\n\r\n        # If we're requested to get the field value from a Ninja document we'll specify it here.\r\n        $DocumentationParams = @{}\r\n        if ($DocumentName) { $DocumentationParams[\"DocumentName\"] = $DocumentName }\r\n\r\n        # These two types require more information to parse.\r\n        $NeedsOptions = \"DropDown\",\"MultiSelect\"\r\n\r\n        # Grabbing document values requires a slightly different command.\r\n        if ($DocumentName) {\r\n            # Secure fields are only readable when they're a device custom field\r\n            if ($Type -Like \"Secure\") { throw \"$Type is an invalid type! Please check here for valid types. https:\/\/ninjarmm.zendesk.com\/hc\/en-us\/articles\/16973443979789-Command-Line-Interface-CLI-Supported-Fields-and-Functionality\" }\r\n\r\n            # We'll redirect the error output to the success stream to make it easier to error out if nothing was found or something else went wrong.\r\n            Write-Host \"Retrieving value from Ninja Document...\"\r\n            $NinjaPropertyValue = Ninja-Property-Docs-Get -AttributeName $Name @DocumentationParams 2&gt;&amp;1\r\n\r\n            # Certain fields require more information to parse.\r\n            if ($NeedsOptions -contains $Type) {\r\n                $NinjaPropertyOptions = Ninja-Property-Docs-Options -AttributeName $Name @DocumentationParams 2&gt;&amp;1\r\n            }\r\n        }\r\n        else {\r\n            # We'll redirect error output to the success stream to make it easier to error out if nothing was found or something else went wrong.\r\n            $NinjaPropertyValue = Ninja-Property-Get -Name $Name 2&gt;&amp;1\r\n\r\n            # Certain fields require more information to parse.\r\n            if ($NeedsOptions -contains $Type) {\r\n                $NinjaPropertyOptions = Ninja-Property-Options -Name $Name 2&gt;&amp;1\r\n            }\r\n        }\r\n\r\n        # If we received some sort of error it should have an exception property and we'll exit the function with that error information.\r\n        if ($NinjaPropertyValue.Exception) { throw $NinjaPropertyValue }\r\n        if ($NinjaPropertyOptions.Exception) { throw $NinjaPropertyOptions }\r\n\r\n        # This switch will compare the type given with the quoted string. If it matches, it'll parse it further; otherwise, the default option will be selected.\r\n        switch ($Type) {\r\n            \"Attachment\" {\r\n                # Attachments come in a JSON format this will convert it into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Checkbox\" {\r\n                # Checkbox's come in as a string representing an integer. We'll need to cast that string into an integer and then convert it to a more traditional boolean.\r\n                [System.Convert]::ToBoolean([int]$NinjaPropertyValue)\r\n            }\r\n            \"Date or Date Time\" {\r\n                # In Ninja Date and Date\/Time fields are in Unix Epoch time in the UTC timezone the below should convert it into local time as a datetime object.\r\n                $UnixTimeStamp = $NinjaPropertyValue\r\n                $UTC = (Get-Date \"1970-01-01 00:00:00\").AddSeconds($UnixTimeStamp)\r\n                $TimeZone = [TimeZoneInfo]::Local\r\n                [TimeZoneInfo]::ConvertTimeFromUtc($UTC, $TimeZone)\r\n            }\r\n            \"Decimal\" {\r\n                # In ninja decimals are strings that represent a decimal this will cast it into a double data type.\r\n                [double]$NinjaPropertyValue\r\n            }\r\n            \"Device Dropdown\" {\r\n                # Device Drop-Downs Fields come in a JSON format this will convert it into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Device MultiSelect\" {\r\n                # Device Multi-Select Fields come in a JSON format this will convert it into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Dropdown\" {\r\n                # Drop-Down custom fields come in as a comma-separated list of GUIDs; we'll compare these with all the options and return just the option values selected instead of a GUID.\r\n                $Options = $NinjaPropertyOptions -replace '=', ',' | ConvertFrom-Csv -Header \"GUID\", \"Name\"\r\n                $Options | Where-Object { $_.GUID -eq $NinjaPropertyValue } | Select-Object -ExpandProperty Name\r\n            }\r\n            \"Integer\" {\r\n                # Cast's the Ninja provided string into an integer.\r\n                if($NinjaPropertyValue){\r\n                    [int]$NinjaPropertyValue\r\n                }else{\r\n                    $NinjaPropertyValue\r\n                }\r\n            }\r\n            \"MultiSelect\" {\r\n                # Multi-Select custom fields come in as a comma-separated list of GUID's we'll compare these with all the options and return just the option values selected instead of a guid.\r\n                $Options = $NinjaPropertyOptions -replace '=', ',' | ConvertFrom-Csv -Header \"GUID\", \"Name\"\r\n                $Selection = ($NinjaPropertyValue -split ',').trim()\r\n\r\n                foreach ($Item in $Selection) {\r\n                    $Options | Where-Object { $_.GUID -eq $Item } | Select-Object -ExpandProperty Name\r\n                }\r\n            }\r\n            \"Organization Dropdown\" {\r\n                # Turns the Ninja provided JSON into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Organization Location Dropdown\" {\r\n                # Turns the Ninja provided JSON into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Organization Location MultiSelect\" {\r\n                # Turns the Ninja provided JSON into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Organization MultiSelect\" {\r\n                # Turns the Ninja provided JSON into a PowerShell Object.\r\n                $NinjaPropertyValue | ConvertFrom-Json\r\n            }\r\n            \"Time\" {\r\n                # Time fields are given as a number of seconds starting from midnight. This will convert it into a datetime object.\r\n                $Seconds = $NinjaPropertyValue\r\n                $UTC = ([timespan]::fromseconds($Seconds)).ToString(\"hh\\:mm\\:ss\")\r\n                $TimeZone = [TimeZoneInfo]::Local\r\n                $ConvertedTime = [TimeZoneInfo]::ConvertTimeFromUtc($UTC, $TimeZone)\r\n\r\n                Get-Date $ConvertedTime -DisplayHint Time\r\n            }\r\n            default {\r\n                # If no type was given or not one that matches the above types just output what we retrieved.\r\n                $NinjaPropertyValue\r\n            }\r\n        }\r\n    }\r\n}\r\nprocess {\r\n    if ($FromCustomField) {\r\n        try{\r\n            $CustomFieldValue = Get-NinjaProperty -Name $FromCustomField -Type \"Integer\"\r\n        }catch{\r\n            Write-Warning \"$($_.ToString())\"\r\n        }\r\n\r\n        if($CustomFieldValue){\r\n            $FailedFor = $CustomFieldValue\r\n        }else{\r\n            Write-Warning \"Custom Field $FromCustomField was empty?\"\r\n        }\r\n    }\r\n\r\n    if($FailedFor -gt 0){\r\n        $FailedFor = $FailedFor * -1\r\n    }\r\n\r\n    $Threshold = (Get-Date).AddMinutes($FailedFor)\r\n    Write-Host \"Checking vm's that have not replicated prior to $Threshold.\"\r\n\r\n    $Failed = New-Object System.Collections.Generic.List[string]\r\n    $UnhealthyVMs = Get-VMReplication | Where-Object { $_.Health -notlike \"Normal\" -and $_.LastReplicationTime -lt $Threshold -and $_.State -notlike \"Suspended\" }\r\n    $PausedVMs = Get-VMReplication | Where-Object { $_.LastReplicationTime -lt $Threshold -and $_.State -like \"Suspended\" }\r\n\r\n    if ($UnhealthyVMs) {\r\n        $Failed.Add($UnhealthyVMs)\r\n    }\r\n    \r\n    if ($PausedVMs) {\r\n        Write-Warning \"Some of the vm's currently have replication paused!\"\r\n\r\n        if(-not $IncludePaused){\r\n            Write-Warning \"Please use 'Include Paused Replications' to include paused replications in the alert. Otherwise, they will be skipped.\"\r\n        }\r\n    }\r\n\r\n    if ($PausedVMs -and $IncludePaused) {\r\n        $Failed.Add($PausedVMs)\r\n    }\r\n\r\n    if ($Failed) {\r\n        Write-Error \"Hyper-V Replication is currently failing!\"\r\n        Get-VMReplication | Format-Table -Property VMName, PrimaryServer, State, Health, LastReplicationTime | Out-String | Write-Host\r\n        exit 1\r\n    }\r\n    else {\r\n        Write-Host \"No failing replications detected prior to $Threshold.\"\r\n\r\n        Get-VMReplication | Format-Table -Property VMName, PrimaryServer, State, Health, LastReplicationTime | Out-String | Write-Host\r\n        exit 0\r\n    }\r\n}end {\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 ist ein PowerShell-Dienstprogramm zur \u00dcberwachung des Status der Hyper-V-Replikation. Es pr\u00fcft den Replikationsstatus und den Zustand jeder VM und alarmiert die Administratoren, wenn es Probleme gibt. Die wichtigsten Bestandteile des Drehbuchs sind:<\/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>Cmdlet-Bindung und Parameter<\/strong>: Das Skript verwendet erweiterte Funktionen, die Parameter wie <strong>-FailedFor<\/strong>, <strong>-FromCustomField<\/strong> und <strong>-IncludePaused<\/strong>zulassen.<\/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>Umgebungsvariablen und Funktionen<\/strong>: Es verwendet benutzerdefinierte Funktionen und Umgebungsvariablen, um erh\u00f6hte Berechtigungen zu bestimmen und benutzerdefinierte Feldwerte abzurufen.<\/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>Hauptprozess<\/strong>: Das Skript bewertet den Zustand und die Zeit der Replikation jeder VM und vergleicht sie mit den festgelegten Schwellenwerten. Wenn eine VM nicht innerhalb des festgelegten Zeitrahmens repliziert wurde oder sich in einem anormalen Zustand befindet, wird ein Alarm ausgel\u00f6st.<\/li>\n<\/ul>\n<p>Dieses Skript k\u00f6nnte visuell in einem Flussdiagramm dargestellt werden, in dem die Schritte von der Initialisierung, der Parametereinstellung, der Berechtigungspr\u00fcfung bis hin zur abschlie\u00dfenden Analyse und Alarmierung detailliert beschrieben werden.<\/p>\n<h2>M\u00f6gliche Anwendungsf\u00e4lle<\/h2>\n<p>Stellen Sie sich einen IT-Administrator in einem mittelgro\u00dfen Unternehmen mit einer stabilen virtualisierten Umgebung unter Hyper-V vor. Er w\u00fcrde dieses Skript einsetzen, um den VM-Replikationsstatus regelm\u00e4\u00dfig zu \u00fcberwachen, etwaige Replikationsprobleme schnell zu erkennen und zu beheben und so die Gesch\u00e4ftskontinuit\u00e4t sicherzustellen.<\/p>\n<h2>Vergleiche<\/h2>\n<p>Die \u00dcberwachung der Hyper-V-Replikation erfolgt in der Regel durch manuelle Pr\u00fcfungen oder weniger ausgefeilte Skripte. Dieses Skript automatisiert jedoch den Prozess und bietet eine umfassendere und anpassbare \u00dcberwachung. Es \u00fcbertrifft einfache PowerShell-Befehle oder manuelle GUI-Pr\u00fcfungen an Effizienz und Skalierbarkeit.<\/p>\n<h2>FAQs<\/h2>\n<p><strong>F: Kann dieses Skript auf jeder Version von PowerShell ausgef\u00fchrt werden?<\/strong><br \/>\nA: Es erfordert PowerShell 5.1 oder h\u00f6her.<\/p>\n<p><strong>F: Ist es notwendig, das Skript mit Administratorrechten auszuf\u00fchren?<\/strong><br \/>\nA: Ja, das Skript pr\u00fcft auf erh\u00f6hte Rechte, da es Zugriff auf VM-Replikationsdetails ben\u00f6tigt.<\/p>\n<p><strong>F: Wie kann ich die Alarmschwelle anpassen?<\/strong><br \/>\nA: Verwenden Sie den Parameter <strong>-FailedFor<\/strong>, um einen benutzerdefinierten Zeitrahmen in Minuten festzulegen.<\/p>\n<h2>Auswirkungen<\/h2>\n<p>W\u00e4hrend dieses Skript die \u00dcberwachung der Hyper-V-Replikation verbessert, unterstreicht es auch die Notwendigkeit proaktiver IT-Sicherheitsma\u00dfnahmen. Die rechtzeitige Erkennung und Behebung von Replikationsproblemen ist entscheidend f\u00fcr die Aufrechterhaltung der Datenintegrit\u00e4t und -verf\u00fcgbarkeit.<\/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=\"4\" data-aria-level=\"1\">F\u00fchren Sie das Skript regelm\u00e4\u00dfig aus, um eine kontinuierliche \u00dcberwachung zu gew\u00e4hrleisten.<\/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\">Passen Sie den Parameter <strong>-FailedFor<\/strong> an die spezifischen Anforderungen der Umgebung an.<\/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\">Stellen Sie sicher, dass PowerShell 5.1 oder h\u00f6her installiert ist und mit den erforderlichen Berechtigungen ausgef\u00fchrt wird.<\/li>\n<\/ul>\n<h2>Abschlie\u00dfende \u00dcberlegungen<\/h2>\n<p>Im Zusammenhang mit der Verwaltung virtualisierter Umgebungen bieten Tools wie NinjaOne eine umfassende Plattform f\u00fcr die <a href=\"https:\/\/www.ninjaone.com\/de\/it-management-fuer-unternehmen\/infrastruktur\/\">\u00dcberwachung und Verwaltung der IT-Infrastruktur<\/a>. Die Einbindung eines solchen Skripts in eine gr\u00f6\u00dfere Suite von NinjaOne-Tools kann die F\u00e4higkeit eines Unternehmens verbessern, Hyper-V-Umgebungen effizient zu verwalten und Zuverl\u00e4ssigkeit und Leistung zu gew\u00e4hrleisten.<\/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":[4383],"class_list":["post-257377","script_hub","type-script_hub","status-publish","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/script_hub\/257377","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=257377"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/media?parent=257377"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/operating_system?post=257377"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/de\/wp-json\/wp\/v2\/use_cases?post=257377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}