{"id":248279,"date":"2024-04-30T15:34:18","date_gmt":"2024-04-30T15:34:18","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=248279"},"modified":"2024-04-30T15:34:18","modified_gmt":"2024-04-30T15:34:18","slug":"script-powershell-duree-de-fonctionnement-windows","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/fr\/script-hub\/script-powershell-duree-de-fonctionnement-windows\/","title":{"rendered":"Maximiser l&rsquo;efficacit\u00e9 de l&rsquo;informatique : Guide d\u00e9taill\u00e9 du script PowerShell sur la dur\u00e9e de fonctionnement Windows"},"content":{"rendered":"<h2>Points \u00e0 retenir<\/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>Suivi automatis\u00e9 de la dur\u00e9e de fonctionnement<\/strong>: Le script PowerShell automatise le processus de suivi de la dur\u00e9e de fonctionnement des appareils Windows, offrant ainsi une alternative plus efficace aux v\u00e9rifications manuelles.<\/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>Rapport d\u00e9taill\u00e9<\/strong>: Il fournit des rapports d\u00e9taill\u00e9s sur les pourcentages de dur\u00e9e de fonctionnement, les \u00e9v\u00e9nements de d\u00e9marrage et des p\u00e9riodes sp\u00e9cifiques, ce qui permet une surveillance pr\u00e9cise du syst\u00e8me.<\/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\">D\u00e9lais<strong>personnalisables<\/strong>: Les utilisateurs peuvent sp\u00e9cifier des p\u00e9riodes de temps personnalis\u00e9es pour l&rsquo;analyse, ce qui augmente la flexibilit\u00e9 du script pour les diff\u00e9rents besoins de surveillance.<\/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>Capacit\u00e9 d&rsquo;int\u00e9gration<\/strong>: Le script prend en charge la sortie vers des champs personnalis\u00e9s, ce qui permet l&rsquo;int\u00e9gration avec des outils de gestion informatique tels que NinjaOne.<\/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>Maintenance proactive<\/strong>: Une utilisation r\u00e9guli\u00e8re contribue \u00e0 une maintenance proactive du syst\u00e8me, en identifiant les probl\u00e8mes potentiels avant qu&rsquo;ils ne s&rsquo;aggravent.<\/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>S\u00e9curit\u00e9 et efficacit\u00e9<\/strong>: Le suivi des tendances en mati\u00e8re de dur\u00e9e de fonctionnement est essentiel pour la s\u00e9curit\u00e9 informatique et l&rsquo;efficacit\u00e9 op\u00e9rationnelle.<\/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>Outil compl\u00e9mentaire<\/strong>: Id\u00e9al pour compl\u00e9ter les solutions de gestion informatique existantes afin de fournir une vue d&rsquo;ensemble de la sant\u00e9 du syst\u00e8me.<\/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>Accessibilit\u00e9 et commodit\u00e9<\/strong>: Le script est accessible aux professionnels de l&rsquo;informatique, quel que soit leur niveau de comp\u00e9tence, et facilite les v\u00e9rifications de routine du syst\u00e8me.<\/li>\n<\/ul>\n<h2>Introduction<\/h2>\n<p>La mesure de la <a href=\"https:\/\/www.ninjaone.com\/it-hub\/it-service-management\/what-is-uptime-downtime\/\">dur\u00e9e de fonctionnement d&rsquo;un appareil<\/a> est cruciale dans le monde informatique. Savoir combien de temps les syst\u00e8mes ont fonctionn\u00e9 sans red\u00e9marrage peut aider \u00e0 maintenir des performances optimales et \u00e0 r\u00e9soudre les probl\u00e8mes. Un script PowerShell capable de calculer et de signaler avec pr\u00e9cision la dur\u00e9e de fonctionnement des appareils Windows est un outil pr\u00e9cieux pour les professionnels de l&rsquo;informatique.<\/p>\n<h2>Contexte<\/h2>\n<p>Le script en question est con\u00e7u pour surveiller et signaler le pourcentage de disponibilit\u00e9 d&rsquo;un p\u00e9riph\u00e9rique Windows, y compris les d\u00e9tails des \u00e9v\u00e9nements de d\u00e9marrage. C&rsquo;est particuli\u00e8rement important pour les professionnels de l&rsquo;informatique et les <a href=\"https:\/\/www.ninjaone.com\/fr\/quest-ce-quun-msp\/\">fournisseurs de services g\u00e9r\u00e9s (MSP)<\/a>, car cela permet une maintenance proactive et une r\u00e9ponse rapide aux probl\u00e8mes du syst\u00e8me. La capacit\u00e9 \u00e0 d\u00e9terminer avec pr\u00e9cision la disponibilit\u00e9 des appareils sur une p\u00e9riode donn\u00e9e est essentielle dans divers sc\u00e9narios, qu&rsquo;il s&rsquo;agisse de contr\u00f4les de maintenance de routine ou de l&rsquo;identification de d\u00e9faillances potentielles du syst\u00e8me.<\/p>\n<h2>Le script :<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">#Requires -Version 4.0\r\n\r\n&lt;#\r\n.SYNOPSIS\r\n    Get the Uptime percentage of a Windows device and show a list of boot events.\r\n.DESCRIPTION\r\n    Get the Uptime percentage of a Windows device and show a list of boot events.\r\n\r\n    Unexpected Shutdowns can skew results slightly.\r\n\r\n    Duration in results is in days.\r\n.Example\r\n    (No Parameters)\r\n\r\n    WARNING: No time frame specified. Checking uptime percentage for the last 30 days\r\n    Creating uptime entries based on event logs...\r\n    Uptime entries created!\r\n    WARNING: Estimating unexpected shutdown times. This will not be 100% accurate.\r\n\r\n    Oldest uptime record: 06\/29\/2023 22:24:01\r\n\r\n    Filtering uptime records to your time frame...\r\n    Calculating uptime during time frame...\r\n\r\n    ### Time Frame ###\r\n    Start Date: 12\/26\/2023 19:39:38\r\n    End Date: 01\/25\/2024 19:39:38\r\n\r\n    ### Statistics ###\r\n    Percentage Online: 3.93%\r\n    Total Time Frame: 30d\r\n    Total Uptime: 1d 4h 19m 14s\r\n\r\n    ### Uptime Entries ###\r\n\r\n    BootType     BootTime             ShutdownTime Duration     \r\n    --------     --------             ------------ --------     \r\n    Current Boot 1\/24\/2024 3:20:23 PM              1d 4h 19m 14s\r\n.EXAMPLE\r\n    -Days 30\r\n\r\n    WARNING: No time frame specified. Checking uptime percentage for the last 30 days\r\n    Creating uptime entries based on event logs...\r\n    Uptime entries created!\r\n    WARNING: Estimating unexpected shutdown times. This will not be 100% accurate.\r\n\r\n    Oldest uptime record: 06\/29\/2023 22:24:01\r\n\r\n    Filtering uptime records to your time frame...\r\n    Calculating uptime during time frame...\r\n\r\n    ### Time Frame ###\r\n    Start Date: 12\/26\/2023 19:39:38\r\n    End Date: 01\/25\/2024 19:39:38\r\n\r\n    ### Statistics ###\r\n    Percentage Online: 3.93%\r\n    Total Time Frame: 30d\r\n    Total Uptime: 1d 4h 19m 14s\r\n\r\n    ### Uptime Entries ###\r\n\r\n    BootType     BootTime             ShutdownTime Duration     \r\n    --------     --------             ------------ --------     \r\n    Current Boot 1\/24\/2024 3:20:23 PM              1d 4h 19m 14s\r\n.EXAMPLE\r\n    -StartDay \"2023-07-01T00:00:00.000-07:00\" -EndDay \"2023-07-31T00:00:00.000-07:00\"\r\n\r\n    Creating uptime entries based on event logs...\r\n    Uptime entries created!\r\n    WARNING: Estimating unexpected shutdown times. This will not be 100% accurate.\r\n\r\n    Oldest uptime record: 06\/29\/2023 22:24:01\r\n\r\n    Filtering uptime records to your time frame...\r\n    Calculating uptime during time frame...\r\n\r\n    ### Time Frame ###\r\n    Start Date: 07\/01\/2023 00:00:00\r\n    End Date: 07\/31\/2023 00:00:00\r\n\r\n    ### Statistics ###\r\n    Percentage Online: 89%\r\n    Total Time Frame: 30d\r\n    Total Uptime: 26d 16h 49m 17s\r\n\r\n    ### Uptime Entries ###\r\n\r\n    BootType            BootTime              ShutdownTime           Duration       \r\n    --------            --------              ------------           --------       \r\n    Normal              7\/26\/2023 12:16:34 PM 12\/21\/2023 11:24:17 AM 147d 23h 7m 42s\r\n    Normal              7\/26\/2023 11:52:47 AM 7\/26\/2023 12:16:26 PM  23m 39s        \r\n    Normal              7\/26\/2023 11:22:46 AM 7\/26\/2023 11:52:40 AM  29m 53s        \r\n    Normal              7\/26\/2023 10:55:08 AM 7\/26\/2023 11:22:38 AM  27m 29s        \r\n    Unexpected Shutdown 7\/26\/2023 10:42:45 AM 7\/26\/2023 10:53:16 AM  10m 30s        \r\n    Normal              7\/24\/2023 11:09:01 AM 7\/24\/2023 11:35:43 AM  26m 42s        \r\n    Normal              7\/24\/2023 10:45:38 AM 7\/24\/2023 11:08:53 AM  23m 15s        \r\n    Normal              7\/24\/2023 9:50:52 AM  7\/24\/2023 9:58:47 AM   7m 54s         \r\n    Normal              7\/24\/2023 8:08:34 AM  7\/24\/2023 8:10:16 AM   1m 41s         \r\n    Normal              7\/20\/2023 5:26:15 PM  7\/24\/2023 8:08:26 AM   3d 14h 42m 11s \r\n    Normal              7\/20\/2023 5:21:09 PM  7\/20\/2023 5:26:08 PM   4m 59s         \r\n    Normal              7\/20\/2023 4:08:28 PM  7\/20\/2023 5:21:02 PM   1h 12m 33s     \r\n    Unexpected Shutdown 6\/29\/2023 10:41:23 PM 7\/19\/2023 10:35:01 AM  19d 11h 53m 38s\r\n\r\nPARAMETER: -Days \"replaceMeWithANumber\"\r\n    Gets the uptime for the past X days.\r\n\r\nPARAMETER: -StartDay \"2023-07-01T00:00:00.000-07:00\"\r\n    Gets the uptime starting from the specified day.\r\n\r\nPARAMETER: -EndDay \"2023-07-31T00:00:00.000-07:00\"\r\n    Gets the uptime ending on the specified day.\r\n\r\nPARAMETER: -WysiwygCustomField \"The name of your selected custom field.\"\r\n    Outputs the results to a WYSIWYG custom field.\r\n\r\nPARAMETER: -PercentageCustomField \"The name of a text custom field\"\r\n    Outputs the results to a text custom field.\r\n\r\nPARAMETER: -EstimateUnexpectedShutdown\r\n    Tells the script to estimate the shutdown time and date using the last known eventlog for that range.\r\n.OUTPUTS\r\n    PSObject\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 8, Windows Server 2012\r\n    Release Notes: 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\r\n[CmdletBinding()]\r\nparam (\r\n    [Parameter()]\r\n    [int]$Days,\r\n    [Parameter()]\r\n    $StartDay,\r\n    [Parameter()]\r\n    $EndDay,\r\n    [Parameter()]\r\n    [string]$WysiwygCustomField,\r\n    [Parameter()]\r\n    [String]$PercentageCustomField,\r\n    [Parameter()]\r\n    [Switch]$EstimateUnexpectedShutdown = [System.Convert]::ToBoolean($env:estimateUnexpectedShutdownTime)\r\n)\r\n\r\nbegin {\r\n    if ($env:uptimeForThePastXDays -and $env:uptimeForThePastXDays -notlike \"null\") { $Days = $env:uptimeForThePastXDays }\r\n    if ($env:startDay -and $env:startDay -notlike \"null\") { $StartDay = $env:startDay }\r\n    if ($env:endDay -and $env:endDay -notlike \"null\") { $EndDay = $env:endDay }\r\n    if ($env:wysiwygCustomFieldName -and $env:wysiwygCustomFieldName -notlike \"null\") { $WysiwygCustomField = $env:wysiwygCustomFieldName }\r\n    if ($env:percentageCustomFieldName -and $env:percentageCustomFieldName -notlike \"null\") { $PercentageCustomField = $env:percentageCustomFieldName }\r\n\r\n    if ($StartDay -and $EndDay) {\r\n        $StartDay = Get-Date -Date $StartDay\r\n        $EndDay = Get-Date -Date $EndDay\r\n    }\r\n\r\n    if ($Days -and ($StartDay -or $EndDay)) { Write-Host \"[Error] You cannot use 'The Past X Days' and 'Start Day' or 'End Day' at the same time\"; exit 1 }\r\n    if (-not $Days -and -not $StartDay -and -not $EndDay) { Write-Warning \"No time frame specified. Checking uptime percentage for the last 30 days\"; $Days = 30 }\r\n    if (($StartDay -and -not $EndDay) -or ($EndDay -and -not $StartDay)) { Write-Host \"[Error] Start Day must be used with End Day.\"; exit 1 }\r\n    if ($StartDay -and $StartDay -ge $EndDay) { Write-Host \"[Error] Start Day must be before End Day\"; exit 1 }\r\n\r\n    if ($Days) {\r\n        $StartDay = (Get-Date).AddDays(-$Days)\r\n        $EndDay = Get-Date\r\n    }\r\n\r\n    function ConvertFrom-TimeSpan {\r\n        [CmdletBinding()]\r\n        [OutputType([string[]])]\r\n        param(\r\n            [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]\r\n            [TimeSpan[]]$TimeSpan\r\n        )\r\n        process {\r\n            $Days = if ($($_.Days)) { \"$($_.Days)d\" }else { \"\" }\r\n            $Hours = if ($($_.Hours)) { \"$($_.Hours)h\" }else { \"\" }\r\n            $Minutes = if ($($_.Minutes)) { \"$($_.Minutes)m\" }else { \"\" }\r\n            $Seconds = if ($($_.Seconds)) { \"$($_.Seconds)s\" }else { \"\" }\r\n            \"$($(@($Days, $Hours, $Minutes, $Seconds) | Select-Object -Unique) -join ' ')\".Trim()\r\n        }\r\n    }\r\n\r\n    function Set-NinjaProperty {\r\n        [CmdletBinding()]\r\n        Param(\r\n            [Parameter(Mandatory = $True)]\r\n            [String]$Name,\r\n            [Parameter()]\r\n            [String]$Type,\r\n            [Parameter(Mandatory = $True, ValueFromPipeline = $True)]\r\n            $Value,\r\n            [Parameter()]\r\n            [String]$DocumentName\r\n        )\r\n    \r\n        $Characters = $Value | Measure-Object -Character | Select-Object -ExpandProperty Characters\r\n        if ($Characters -ge 10000) {\r\n            throw [System.ArgumentOutOfRangeException]::New(\"Character limit exceeded, value is greater than 10,000 characters.\")\r\n        }\r\n        \r\n        # If we're requested to set the field value for a Ninja document we'll specify it here.\r\n        $DocumentationParams = @{}\r\n        if ($DocumentName) { $DocumentationParams[\"DocumentName\"] = $DocumentName }\r\n        \r\n        # This is a list of valid fields that can be set. If no type is given, it will be assumed that the input doesn't need to be changed.\r\n        $ValidFields = \"Attachment\", \"Checkbox\", \"Date\", \"Date or Date Time\", \"Decimal\", \"Dropdown\", \"Email\", \"Integer\", \"IP Address\", \"MultiLine\", \"MultiSelect\", \"Phone\", \"Secure\", \"Text\", \"Time\", \"URL\", \"WYSIWYG\"\r\n        if ($Type -and $ValidFields -notcontains $Type) { Write-Warning \"$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        # The field below requires additional information to be set\r\n        $NeedsOptions = \"Dropdown\"\r\n        if ($DocumentName) {\r\n            if ($NeedsOptions -contains $Type) {\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                $NinjaPropertyOptions = Ninja-Property-Docs-Options -AttributeName $Name @DocumentationParams 2&gt;&amp;1\r\n            }\r\n        }\r\n        else {\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 an error is received it will have an exception property, the function will exit with that error information.\r\n        if ($NinjaPropertyOptions.Exception) { throw $NinjaPropertyOptions }\r\n        \r\n        # The below type's require values not typically given in order to be set. The below code will convert whatever we're given into a format ninjarmm-cli supports.\r\n        switch ($Type) {\r\n            \"Checkbox\" {\r\n                # While it's highly likely we were given a value like \"True\" or a boolean datatype it's better to be safe than sorry.\r\n                $NinjaValue = [System.Convert]::ToBoolean($Value)\r\n            }\r\n            \"Date or Date Time\" {\r\n                # Ninjarmm-cli expects the GUID of the option to be selected. Therefore, the given value will be matched with a GUID.\r\n                $Date = (Get-Date $Value).ToUniversalTime()\r\n                $TimeSpan = New-TimeSpan (Get-Date \"1970-01-01 00:00:00\") $Date\r\n                $NinjaValue = $TimeSpan.TotalSeconds\r\n            }\r\n            \"Dropdown\" {\r\n                # Ninjarmm-cli is expecting the guid of the option we're trying to select. So we'll match up the value we were given with a guid.\r\n                $Options = $NinjaPropertyOptions -replace '=', ',' | ConvertFrom-Csv -Header \"GUID\", \"Name\"\r\n                $Selection = $Options | Where-Object { $_.Name -eq $Value } | Select-Object -ExpandProperty GUID\r\n        \r\n                if (-not $Selection) {\r\n                    throw [System.ArgumentOutOfRangeException]::New(\"Value is not present in dropdown\")\r\n                }\r\n        \r\n                $NinjaValue = $Selection\r\n            }\r\n            default {\r\n                # All the other types shouldn't require additional work on the input.\r\n                $NinjaValue = $Value\r\n            }\r\n        }\r\n        \r\n        # We'll need to set the field differently depending on if its a field in a Ninja Document or not.\r\n        if ($DocumentName) {\r\n            $CustomField = Ninja-Property-Docs-Set -AttributeName $Name -AttributeValue $NinjaValue @DocumentationParams 2&gt;&amp;1\r\n        }\r\n        else {\r\n            $CustomField = Ninja-Property-Set -Name $Name -Value $NinjaValue 2&gt;&amp;1\r\n        }\r\n        \r\n        if ($CustomField.Exception) {\r\n            throw $CustomField\r\n        }\r\n    }\r\n    $ExitCode = 0\r\n}\r\nprocess {\r\n    if (\r\n        $PSCmdlet.ParameterSetName -like \"StartEndDays\" -and $StartDay -ge $EndDay -or\r\n        $($StartDay -and $EndDay -and $StartDay -ge $EndDay)\r\n    ) {\r\n        Write-Error \"StartDay must be less than EndDay.\"\r\n        exit 1\r\n    }\r\n    \r\n    # Gathers all the event logs pertaining to startup and shutdowns\r\n    $eventFilter = @{\r\n        LogName      = 'System'\r\n        ProviderName = @('Microsoft-Windows-Kernel-General', 'Microsoft-Windows-Eventlog')\r\n        ID           = 12, 13, 6008\r\n    }\r\n    $Events = Get-WinEvent -FilterHashtable $eventFilter\r\n\r\n    $BootEntries = New-Object System.Collections.Generic.List[object]\r\n    $i = 0\r\n    $BootTime = $null\r\n    $ShutdownTime = $null\r\n\r\n    Write-Host \"Creating uptime entries based on event logs...\"\r\n    $Events | ForEach-Object {\r\n        # If this is the first event it is for our current boot\r\n        if ($i -eq 0) {\r\n            $BootEntries.Add(\r\n                [PSCustomObject]@{\r\n                    BootType     = \"Current Boot\"\r\n                    BootTime     = $_.TimeCreated\r\n                    ShutdownTime = $null\r\n                    Duration     = if ((((Get-Date) - $EndDay).TotalDays -lt 1)) { New-TimeSpan -Start $_.TimeCreated -End $EndDay }else { (New-TimeSpan -Start $_.TimeCreated -End $(Get-Date)) }\r\n                }\r\n            )\r\n            $i++\r\n            return\r\n        }\r\n\r\n        # Check to see if the next event is either an Unexpected Shutdown or a Startup Entry\r\n        if ($_.Id -eq 13 -and ($Events[$($i + 1)].Id -eq 12 -or $Events[$($i + 1)].Id -eq 6008)) {\r\n            $ShutdownTime = $_.TimeCreated\r\n            $BootTime = $Events[$($i + 1)].TimeCreated\r\n        }\r\n\r\n        # Check to see if the previous entry was something other than shutdown and the next event is a shutdown event.\r\n        if ($_.Id -eq 12 -and ($Events[$($i - 1)].Id -ne 13) -and ($Events[$($i + 1)].Id -eq 13)) {\r\n            # There's no end record for unexpected shutdowns so we'll need to record that\r\n            $BootEntries.Add(\r\n                [PSCustomObject]@{\r\n                    BootType     = \"Unexpected Shutdown\"\r\n                    BootTime     = $_.TimeCreated\r\n                    ShutdownTime = $null\r\n                    Duration     = $null\r\n                }\r\n            )\r\n        }\r\n\r\n        # If there are no special cases record the information\r\n        if ($BootTime -and $ShutdownTime) {\r\n            $BootEntries.Add(\r\n                [PSCustomObject]@{\r\n                    BootType     = \"Normal\"\r\n                    BootTime     = $BootTime\r\n                    ShutdownTime = $ShutdownTime\r\n                    Duration     = (New-TimeSpan -Start $BootTime -End $ShutdownTime)\r\n                }\r\n            )\r\n            $BootTime = $null\r\n            $ShutdownTime = $null\r\n        }\r\n\r\n        $i++\r\n    }\r\n\r\n    Write-Host \"Uptime entries created!\"\r\n\r\n    # Warn about unexpected shutdown's effect on the report\r\n    if ($BootEntries.BootType -contains \"Unexpected Shutdown\" -and -not $EstimateUnexpectedShutdown) {\r\n        Write-Warning \"There are unexpected shutdowns in your boot history (may or may not be within your timeframe).\" \r\n        Write-Warning \"Unexpected shutdowns do NOT have a shutdown time and will be excluded from all calculations.\"\r\n    }\r\n    elseif ($BootEntries.BootType -contains \"Unexpected Shutdown\") {\r\n        # If requested to estimate the shutdown time. Estimate it based on the last event log prior to the next bootup.\r\n        Write-Warning \"Estimating unexpected shutdown times. This will not be 100% accurate.\"\r\n        $entry = 0\r\n        $BootEntries | ForEach-Object {\r\n            if ($_.BootType -ne \"Unexpected Shutdown\") {\r\n                $entry++\r\n                return\r\n            }\r\n\r\n            $EventFilter = @{\r\n                LogName   = \"*\"\r\n                StartTime = $_.BootTime\r\n                EndTime   = $BootEntries[$($entry - 1)].BootTime\r\n            }\r\n\r\n            # We only want one event to minimize impact on performance\r\n            $LastEvent = Get-WinEvent -FilterHashtable $EventFilter -MaxEvents 1\r\n            $_.ShutdownTime = $LastEvent.TimeCreated\r\n            $_.Duration = (New-TimeSpan -Start $_.BootTime -End $LastEvent.TimeCreated)\r\n            $entry++\r\n        }\r\n    }\r\n\r\n    Write-Host \"`nOldest uptime record: $($BootEntries | Select-Object -ExpandProperty BootTime -Last 1)`n\"\r\n\r\n    # We now have all the information needed to decide what uptime records should be output.\r\n    Write-Host \"Filtering uptime records to your time frame...\"\r\n    $ReportableBootEntries = New-Object System.Collections.Generic.List[object]\r\n    $BootEntries | ForEach-Object {\r\n        if ($_.Duration) {\r\n            $_.Duration = $_.Duration | ConvertFrom-TimeSpan\r\n        }\r\n\r\n        if ( $_.ShutdownTime -and $_.ShutdownTime -le $EndDay -and $_.ShutdownTime -ge $StartDay) {\r\n            $ReportableBootEntries.Add($_)\r\n            return\r\n        }\r\n\r\n        if ( $_.BootType -eq \"Current Boot\" -and $_.BootTime -le $StartDay -and $_.BootTime -le $EndDay ) {\r\n            $ReportableBootEntries.Add($_)\r\n            return\r\n        }\r\n\r\n        if ( $_.BootTime -and $_.BootTime -ge $StartDay -and $_.BootTime -le $EndDay) {\r\n            $ReportableBootEntries.Add($_)\r\n            return\r\n        }\r\n    }\r\n\r\n    # Now let's use our information to calculate the total amount of time the system has been online in the time range.\r\n    Write-Host \"Calculating uptime during time frame...\"\r\n    $ReportableBootEntries | ForEach-Object {\r\n        # If the current boot is in the time range we'll need to use the End Date as the ending time frame.\r\n        if ($_.BootType -eq \"Current Boot\" -and $_.BootTime -gt $StartDay) {\r\n            $TotalTimeOnline = $TotalTimeOnline + (New-TimeSpan -Start $_.BootTime -End $EndDay)\r\n            return\r\n        }\r\n        elseif ($_.BootType -eq \"Current Boot\") {\r\n            # If the boot time is older than the start date we'll use the start date.\r\n            $TotalTimeOnline = $TotalTimeOnline + (New-TimeSpan -Start $StartDay -End $EndDay)\r\n            return\r\n        }\r\n\r\n        # If we're missing the information required to make these calculations we should skip it.\r\n        if (-not $_.BootTime -or -not $_.ShutdownTime) {\r\n            return\r\n        }\r\n\r\n        # If the uptime entry is in our time range we can add it straight in.\r\n        if ($_.BootTime -ge $StartDay -and $_.ShutdownTime -le $EndDay) {\r\n            $TotalTimeOnline = $TotalTimeOnline + (New-TimeSpan -Start $_.BootTime -End $_.ShutdownTime)\r\n            return\r\n        }\r\n\r\n        # If the uptime entry starts to early then we need to use the start day as the starting point.\r\n        if ($_.BootTime -le $StartDay -and $_.ShutdownTime -le $EndDay) {\r\n            $TotalTimeOnline = $TotalTimeOnline + (New-TimeSpan -Start $StartDay -End $_.ShutdownTime)\r\n            return\r\n        }\r\n\r\n        # If the uptime entry goes too long than we need to use the end date as a reference.\r\n        if ($_.ShutdownTime -ge $EndDay -and $_.BootTime -ge $StartDay) {\r\n            $TotalTimeOnline = $TotalTimeOnline + (New-TimeSpan -Start $_.BootTime -End $EndDay)\r\n            return\r\n        }\r\n\r\n        # If the uptime entry is both before the start day and after the end day we'll use both the start and end day.\r\n        if ($_.ShutdownTime -ge $EndDay -and $_.BootTime -le $StartDay) {\r\n            $TotalTimeOnline = $TotalTimeOnline + (New-TimeSpan -Start $StartDay -End $EndDay)\r\n            return\r\n        }\r\n    }\r\n\r\n    # We're now ready to output our results to the activity log\r\n    Write-Host \"\"\r\n\r\n    $TotalTimeFrame = (New-TimeSpan -Start $StartDay -End $EndDay)\r\n    Write-Host \"### Time Frame ###\"\r\n    Write-Host \"Start Date: $StartDay\"\r\n    Write-Host \"End Date: $EndDay`n\"\r\n\r\n    # For the percentage we'll take the total number of seconds it was online for and divide it by the total number of seconds possible\r\n    $Percentage = $([math]::Round(($TotalTimeOnline.TotalSeconds \/ $TotalTimeFrame.TotalSeconds * 100), 2))\r\n    Write-Host \"### Statistics ###\"\r\n    Write-Host \"Percentage Online: $Percentage%\"\r\n    Write-Host \"Total Time Frame: $($TotalTimeFrame | ConvertFrom-TimeSpan)\"\r\n    if ($TotalTimeOnline) {\r\n        $HumanFriendlyTotalUptime = $($TotalTimeOnline | ConvertFrom-Timespan)\r\n    }\r\n    else {\r\n        $HumanFriendlyTotalUptime = \"0d 0h 0m 0s\"\r\n    }\r\n    Write-Host \"Total Uptime: $HumanFriendlyTotalUptime\"\r\n\r\n    # Let's output our table as well\r\n    Write-Host \"`n### Uptime Entries ###\"\r\n    $ReportableBootEntries | Format-Table -AutoSize | Out-String | Write-Host\r\n\r\n    if ($PercentageCustomField) {\r\n        try {\r\n            Write-Host \"Attempting to set Custom Field '$PercentageCustomField'.\"\r\n            Set-NinjaProperty -Name $PercentageCustomField -Value \"$Percentage%\"\r\n            Write-Host \"Successfully set Custom Field '$PercentageCustomField'!\"\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] $($_.Message)\"\r\n            $ExitCode = 1\r\n        }\r\n    }\r\n\r\n    if ($WysiwygCustomField) {\r\n        try {\r\n            Write-Host \"Attempting to set Custom Field '$WysiwygCustomField'.\"\r\n            $htmlReport = New-Object System.Collections.Generic.List[String]\r\n            $htmlReport.Add(@\"\r\n&lt;h1&gt;Uptime Statistics&lt;\/h1&gt;\r\n&lt;ul class=\"unstyled\"&gt;&lt;strong&gt;Percentage Online:&lt;\/strong&gt; $Percentage%&lt;\/ul&gt;\r\n&lt;ul class=\"unstyled\"&gt;&lt;strong&gt;Uptime (In Range):&lt;\/strong&gt; $HumanFriendlyTotalUptime&lt;\/ul&gt;\r\n&lt;ul class=\"unstyled\"&gt;&lt;strong&gt;Range:&lt;\/strong&gt; $($StartDay.ToShortDateString()) - $($EndDay.ToShortDateString())&lt;\/ul&gt;\r\n\"@)\r\n            $htmlTable = $ReportableBootEntries | ConvertTo-Html -Fragment \r\n            $htmlTable = $htmlTable -replace \"&lt;tr&gt;&lt;td&gt;Current Boot&lt;\/td&gt;\", '&lt;tr class=\"success\"&gt;&lt;td&gt;Current Boot&lt;\/td&gt;'\r\n            $htmlTable = $htmlTable -replace \"&lt;tr&gt;&lt;td&gt;Normal&lt;\/td&gt;\", '&lt;tr class=\"other\"&gt;&lt;td&gt;Normal&lt;\/td&gt;'\r\n            $htmlTable = $htmlTable -replace \"&lt;tr&gt;&lt;td&gt;Unexpected Shutdown&lt;\/td&gt;\", '&lt;tr class=\"danger\"&gt;&lt;td&gt;Unexpected Shutdown&lt;\/td&gt;'\r\n            $htmlTable | ForEach-Object { $htmlReport.Add($_) }\r\n            Set-NinjaProperty -Name $WysiwygCustomField -Value ($htmlReport | Out-String)\r\n            Write-Host \"Successfully set Custom Field '$WysiwygCustomField'!\"\r\n        }\r\n        catch {\r\n            Write-Host \"[Error] $($_.Message)\"\r\n            $ExitCode = 1\r\n        }\r\n    }\r\n\r\n    exit $ExitCode\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>Acc\u00e9dez \u00e0 plus de 700 scripts dans le Dojo NinjaOne<\/p>\n<p><a href=\"https:\/\/www.ninjaone.com\/fr\/phase-de-test-gratuit\/\">Obtenir l&rsquo;acc\u00e8s<\/a><\/p>\n<\/div>\n<h2>Description d\u00e9taill\u00e9e<\/h2>\n<p>Le script fonctionne en plusieurs \u00e9tapes :<\/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>Initialisation des param\u00e8tres :<\/strong> Il accepte des param\u00e8tres tels que le nombre de jours, des dates de d\u00e9but et de fin sp\u00e9cifiques et des noms de champs personnalis\u00e9s pour l&rsquo;\u00e9dition.<\/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>Contr\u00f4le de l&rsquo;environnement :<\/strong> Il ajuste les param\u00e8tres en fonction des variables d&rsquo;environnement si elles sont disponibles.<\/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>Validation :<\/strong> Veille \u00e0 ce que les param\u00e8tres d&rsquo;entr\u00e9e soient logiquement coh\u00e9rents et valides.<\/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>Analyse du journal des \u00e9v\u00e9nements :<\/strong> Le script r\u00e9cup\u00e8re les journaux d&rsquo;\u00e9v\u00e9nements du syst\u00e8me pour identifier les \u00e9v\u00e9nements de d\u00e9marrage et d&rsquo;arr\u00eat.<\/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>Calcul de la dur\u00e9e de fonctionnement :<\/strong> Il calcule la dur\u00e9e de fonctionnement en analysant la dur\u00e9e entre les \u00e9v\u00e9nements de d\u00e9marrage et d&rsquo;arr\u00eat.<\/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>G\u00e9n\u00e9ration de rapports :<\/strong> G\u00e9n\u00e8re un rapport d\u00e9taill\u00e9 comprenant le pourcentage de dur\u00e9e de fonctionnement, la dur\u00e9e totale et les entr\u00e9es de d\u00e9marrage individuelles.<\/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>Sortie des champs personnalis\u00e9s :<\/strong> Il est possible d&rsquo;\u00e9diter les r\u00e9sultats dans les champs personnalis\u00e9s sp\u00e9cifi\u00e9s pour l&rsquo;int\u00e9gration avec d&rsquo;autres outils tels que NinjaOne.<\/li>\n<\/ul>\n<h2>Cas d&rsquo;utilisation potentiels<\/h2>\n<p>Prenons l&rsquo;exemple d&rsquo;un responsable informatique qui supervise un r\u00e9seau d&rsquo;appareils Windows dans un environnement d&rsquo;entreprise. Ils utilisent ce script pour contr\u00f4ler la fiabilit\u00e9 du syst\u00e8me, en particulier apr\u00e8s le d\u00e9ploiement d&rsquo;une mise \u00e0 jour importante. En examinant les statistiques relatives \u00e0 la dur\u00e9e de fonctionnement, ils peuvent traiter de mani\u00e8re proactive tout probl\u00e8me d&rsquo;instabilit\u00e9 ou identifier les appareils qui n\u00e9cessitent une maintenance.<\/p>\n<h2>Comparaisons<\/h2>\n<p>Traditionnellement, la dur\u00e9e de fonctionnement est souvent v\u00e9rifi\u00e9 manuellement via le gestionnaire des t\u00e2ches ou les outils d&rsquo;information du syst\u00e8me sous Windows. Toutefois, ce script automatise le processus, fournit des informations plus d\u00e9taill\u00e9es et permet une analyse historique sur des p\u00e9riodes personnalis\u00e9es, ce qui le rend plus efficace et plus complet.<\/p>\n<h2>FAQ<\/h2>\n<p><strong>Q1 : Ce script peut-il rendre compte des syst\u00e8mes distants ? \u00a0<\/strong><br \/>\nA1 : Oui, s&rsquo;il est ex\u00e9cut\u00e9 dans un environnement r\u00e9seau avec les privil\u00e8ges d&rsquo;acc\u00e8s appropri\u00e9s.<\/p>\n<p><strong>Q2 : Est-il possible de programmer l&rsquo;ex\u00e9cution automatique de ce script ? \u00a0<\/strong><br \/>\nA2 : Oui, le script peut \u00eatre programm\u00e9 \u00e0 l&rsquo;aide du planificateur de t\u00e2ches de Windows ou d&rsquo;outils similaires.<\/p>\n<p><strong>Q3 : Quelle est la pr\u00e9cision de l&rsquo;estimation de l&rsquo;arr\u00eat impr\u00e9vu ? \u00a0<\/strong><br \/>\nA3 : Il fournit une estimation bas\u00e9e sur le dernier journal d&rsquo;\u00e9v\u00e9nements connu, qui n&rsquo;est pas toujours exacte \u00e0 100 %, mais qui offre une approximation proche.<\/p>\n<h2>Implications<\/h2>\n<p>Comprendre la dur\u00e9e de fonctionnement des appareils est essentiel pour la s\u00e9curit\u00e9 et l&rsquo;efficacit\u00e9 de l&rsquo;informatique. Une dur\u00e9e de fonctionnement continu sur de longues p\u00e9riodes peut indiquer que des mises \u00e0 jour ou des correctifs critiques ont \u00e9t\u00e9 oubli\u00e9s, ce qui constitue un risque pour la s\u00e9curit\u00e9. \u00c0 l&rsquo;inverse, des red\u00e9marrages fr\u00e9quents peuvent \u00eatre le signe d&rsquo;une instabilit\u00e9 sous-jacente du syst\u00e8me.<\/p>\n<h2>Recommandations<\/h2>\n<p>Les meilleures pratiques comprennent la programmation r\u00e9guli\u00e8re du script pour une surveillance coh\u00e9rente, la personnalisation des champs de sortie pour l&rsquo;int\u00e9gration avec des outils de gestion informatique, et le compl\u00e9ment de ce script avec d&rsquo;autres outils de surveillance pour une analyse compl\u00e8te du syst\u00e8me.<\/p>\n<h2>Conclusion :<\/h2>\n<p>L&rsquo;int\u00e9gration de ce script PowerShell dans une suite de gestion informatique telle que NinjaOne am\u00e9liore la capacit\u00e9 \u00e0 surveiller et \u00e0 maintenir la sant\u00e9 du syst\u00e8me de mani\u00e8re efficace. <a href=\"https:\/\/www.ninjaone.com\/fr\/\">La plateforme compl\u00e8te de NinjaOne<\/a> compl\u00e8te les capacit\u00e9s du script, en fournissant une vue plus holistique de la sant\u00e9 et de la performance du r\u00e9seau.<\/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":[4285],"class_list":["post-248279","script_hub","type-script_hub","status-publish","hentry","script_hub_category-windows","use_cases-surveillance"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub\/248279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub"}],"about":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/types\/script_hub"}],"author":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/comments?post=248279"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media?parent=248279"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/operating_system?post=248279"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/use_cases?post=248279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}