{"id":269478,"date":"2024-06-06T14:50:58","date_gmt":"2024-06-06T14:50:58","guid":{"rendered":"https:\/\/www.ninjaone.com\/?post_type=script_hub&#038;p=269478"},"modified":"2024-06-06T14:50:58","modified_gmt":"2024-06-06T14:50:58","slug":"gestion-de-l-alimentation-windows-avec-powershell","status":"publish","type":"script_hub","link":"https:\/\/www.ninjaone.com\/fr\/script-hub\/gestion-de-l-alimentation-windows-avec-powershell\/","title":{"rendered":"Ma\u00eetriser la gestion de l&rsquo;alimentation Windows : un guide PowerShell pour les professionnels de l&rsquo;informatique et les entreprises MSP"},"content":{"rendered":"<h2>Principaux 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;335559684&quot;:-2,&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>Gestion automatis\u00e9e de l&rsquo;alimentation<\/strong>: Le script automatise les r\u00e9glages des param\u00e8tres d&rsquo;alimentation et de veille sur les appareils Windows, am\u00e9liorant ainsi l&rsquo;efficacit\u00e9 des environnements informatiques.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Options de configuration polyvalentes<\/strong>: Offre des param\u00e8tres pour l&rsquo;\u00e9cran, l&rsquo;hibernation, les d\u00e9lais de mise en veille, les plans d&rsquo;alimentation et les param\u00e8tres de suspension USB, adaptables \u00e0 diff\u00e9rents besoins.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Capacit\u00e9 de d\u00e9ploiement \u00e0 distance<\/strong>: Id\u00e9al pour les entreprises MSP et les services informatiques, il permet une configuration \u00e0 distance sur plusieurs appareils.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Compatibilit\u00e9 et limites<\/strong>: Compatible avec Windows 7 et les versions ult\u00e9rieures, mais des limitations sp\u00e9cifiques \u00e0 l&rsquo;appareil peuvent s&rsquo;appliquer \u00e0 certains param\u00e8tres.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Contr\u00f4le pr\u00e9cis des param\u00e8tres<\/strong>: Offre plus de flexibilit\u00e9 et de pr\u00e9cision par rapport aux ajustements manuels traditionnels ou aux politiques de groupe.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>V\u00e9rification des param\u00e8tres d&rsquo;application<\/strong>: Comprend des fonctions permettant de confirmer l&rsquo;application r\u00e9ussie des nouveaux r\u00e9glages.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Tests<\/strong>: Il est conseill\u00e9 de tester le script dans un environnement contr\u00f4l\u00e9 afin d&rsquo;\u00e9viter toute perturbation involontaire.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Int\u00e9gration avec les outils de gestion informatique<\/strong>: Peut \u00eatre combin\u00e9 efficacement avec des plateformes telles que NinjaOne pour une gestion compl\u00e8te des actifs informatiques.<\/li>\n<\/ul>\n<p>La gestion des param\u00e8tres d&rsquo;alimentation des appareils Windows est un aspect crucial de la gestion informatique, car elle garantit \u00e0 la fois l&rsquo;efficacit\u00e9 \u00e9nerg\u00e9tique et des performances optimales. Le script PowerShell fourni offre une solution compl\u00e8te aux professionnels de l&rsquo;informatique pour ajuster les param\u00e8tres d&rsquo;alimentation et de veille sur les syst\u00e8mes bas\u00e9s sur Windows. Cette capacit\u00e9 est essentielle pour maintenir la sant\u00e9 du syst\u00e8me, prolonger la dur\u00e9e de vie de la batterie et garantir que les appareils fonctionnent efficacement dans divers environnements.<\/p>\n<h2>Contexte<\/h2>\n<p>Dans le domaine de l&rsquo;informatique, en particulier pour les <a href=\"https:\/\/www.ninjaone.com\/what-is-an-msp\/\">fournisseurs de services g\u00e9r\u00e9s (MSP)<\/a> et les services informatiques, la possibilit\u00e9 d&rsquo;ajuster \u00e0 distance et de mani\u00e8re programmatique les param\u00e8tres d&rsquo;alimentation sur plusieurs appareils est inestimable. Traditionnellement, cela n\u00e9cessitait une intervention manuelle ou des <a href=\"https:\/\/www.ninjaone.com\/blog\/how-to-force-a-gpupdate-remotely-with-powershell\/\">modifications de la politique du groupe<\/a>, ce qui peut s&rsquo;av\u00e9rer fastidieux et chronophage. Le script dont nous parlons ici rationalise ce processus, permettant une configuration pr\u00e9cise et vari\u00e9e de l&rsquo;alimentation pour une flotte d&rsquo;appareils. Sa polyvalence dans la gestion de diff\u00e9rents param\u00e8tres tels que les d\u00e9lais d&rsquo;affichage, d&rsquo;hibernation et de mise en veille, ainsi que les plans d&rsquo;alimentation et les param\u00e8tres de suspension USB, en fait un outil puissant pour les professionnels de l&rsquo;informatique.<\/p>\n<h2>Le script PowerShell\u00a0:<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"powershell\">&lt;#\r\n.SYNOPSIS\r\n    Set Power and Sleep Settings. It can adjust just the plugged in or battery settings if requested.\r\n    Please Note not all devices support all options.\r\n.DESCRIPTION\r\n    Please Note not all devices support all options.\r\n    Options: ScreenTimeout, HibernateTimeout, SleepTimeout, Disk Timeout, PowerPlan, Lid Action, Wake Timers, USB Suspend, Critical Action\r\n    Low Action, Power Button Action, Critical Level, Low Level, Reserve Level, Critical Notification, and Low Notification.\r\n.EXAMPLE\r\n    (No Parameters)\r\n    \r\n    By default The Script doesn't do anything without some parameters.\r\n.LINK \r\n    https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/power\/power-policy-settings\r\n\r\nPARAMETER: -ScreenTimeout \"60\"\r\n    Replace 60 with any time in seconds to set the screen timeout. (0 for disabled)\r\n\r\nPARAMETER: -HibernateTimeout \"28800\"\r\n    Replace 28800 with any time in seconds. (0 for disabled)\r\n\r\nPARAMETER: -SleepTimeout \"14400\"\r\n    Replace 14400 with any time in seconds. (0 for disabled)\r\n\r\nPARAMETER: -DiskTimeout \"0\"\r\n    Replace 0 with your desired time in seconds. (0 for disabled)\r\n\r\nPARAMETER: -PowerPlan \"High Performance\"\r\n    Replace \"High Performance\" with your desired power plan. Keep in mind that most newer computers no longer have seperate power plans.\r\n\r\nPARAMETER: -LidAction \"Nothing\"\r\n    Replace Nothing with one of these three available options. Sleep, Shutdown, Nothing.\r\n    Will be skipped for non-laptops and this script cannot verify if the action was successfully set.\r\n\r\nPARAMETER: -AllowWakeTimers\r\n    Allows the ability for software to wake the computer from sleep at a later date.\r\n\r\nPARAMETER: -DisableWakeTimers\r\n    Disables the ability for software to wake the computer from sleep at a later date.\r\n\r\nPARAMETER: -EnableUSBSuspend\r\n    Allows the OS to suspend USB devices to conserve power.\r\n\r\nPARAMETER: -DisableUSBSuspend\r\n    Disable's the OS's ability to suspend USB devices to conserve power.\r\n\r\nPARAMETER: -CriticalAction \"Hibernate\"\r\n    Replace Hibernate with your desired action for when the machine is at a \"Critical\" batter level.\r\n    Valid Options: Hibernate, Sleep, Shutdown, Nothing\r\n\r\nPARAMETER: -LowAction \"Hibernate\"\r\n    Replace Hibernate with your desired action for when the machine is at a \"Low\" battery level.\r\n    Valid Options: Hibernate, Sleep, Shutdown, Nothing.\r\n\r\nPARAMETER: -CriticalLevel \"7\"\r\n    Replace 7 with your desired battery percent level to be considered critical (without the % symbol).\r\n\r\nPARAMETER: -LowLevel \"10\"\r\n    Replace 10 with your desired battery percent level to be considered low (without the % symbol).\r\n\r\nPARAMETER: -LowNotify\r\n    Allows the notification that comes in when the battery hits \"low\" levels.\r\n\r\nPARAMETER: -AC\r\n    Only applies your chosen battery settings to the \"Plugged In\" section of a power plan.\r\n\r\nPARAMETER: -DC\r\n    Only applies your chosen battery settings to the \"Battery\" section of a power plan.\r\n.OUTPUTS\r\n    None\r\n.NOTES\r\n    Minimum OS Architecture Supported: Windows 7, Windows Server 2008\r\n    General notes\r\n    Version: 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    [String]$ScreenTimeout,\r\n    [Parameter()]\r\n    [String]$HibernateTimeout,\r\n    [Parameter()]\r\n    [String]$SleepTimeout,\r\n    [Parameter()]\r\n    [String]$DiskTimeout,\r\n    [Parameter()]\r\n    [String]$PowerPlan,\r\n    [Parameter()]\r\n    [String]$LidAction,\r\n    [Parameter()]\r\n    [Switch]$AllowWakeTimers,\r\n    [Parameter()]\r\n    [Switch]$DisableWakeTimers,\r\n    [Parameter()]\r\n    [Switch]$EnableUSBSuspend,\r\n    [Parameter()]\r\n    [Switch]$DisableUSBSuspend,\r\n    [Parameter()]\r\n    [String]$CriticalAction,\r\n    [Parameter()]\r\n    [String]$LowAction,\r\n    [Parameter()]\r\n    [String]$CriticalLevel,\r\n    [Parameter()]\r\n    [String]$LowLevel,\r\n    [Parameter()]\r\n    [Switch]$LowNotify,\r\n    [Parameter()]\r\n    [Switch]$LowNoNotify,\r\n    [Parameter()]\r\n    [Switch]$AC,\r\n    [Parameter()]\r\n    [Switch]$DC\r\n)\r\n\r\nbegin {\r\n    # Grab Script Variables if present\r\n    if ($env:policy -and $env:policy -notlike \"null\") {\r\n        switch ($env:policy) {\r\n            \"Plugged In\" { $AC = $True }\r\n            \"On Battery\" { $DC = $True }\r\n        }\r\n    }\r\n    if ($env:screenTimeoutInMinutes -and $env:screenTimeoutInMinutes -notlike \"null\") { $ScreenTimeout = $env:screenTimeoutInMinutes }\r\n    if ($env:hibernateTimeoutInMinutes -and $env:hibernateTimeoutInMinutes -notlike \"null\") { $HibernateTimeout = $env:hibernateTimeoutInMinutes }\r\n    if ($env:sleepTimeoutInMinutes -and $env:sleepTimeoutInMinutes -notlike \"null\") { $SleepTimeout = $env:sleepTimeoutInMinutes }\r\n    if ($env:diskTimeoutInMinutes -and $env:diskTimeoutInMinutes -notlike \"null\") { $DiskTimeout = $env:diskTimeoutInMinutes }\r\n    if ($env:powerPlan -and $env:powerPlan -notlike \"null\") { $PowerPlan = $env:powerPlan }\r\n    if ($env:lidAction -and $env:lidAction -notlike \"null\") { $LidAction = $env:lidAction }\r\n    if ($env:wakeTimers -and $env:wakeTimers -notlike \"null\") {\r\n        switch ($env:wakeTimers) {\r\n            \"Enable\" { $AllowWakeTimers = $True }\r\n            \"Disable\" { $DisableWakeTimers = $True }\r\n        }\r\n    }\r\n    if ($env:usbSuspend -and $env:usbSuspend -notlike \"null\") {\r\n        switch ($env:usbSuspend) {\r\n            \"Enable\" { $EnableUSBSuspend = $True }\r\n            \"Disable\" { $DisableUSBSuspend = $True }\r\n        }\r\n    }\r\n    if ($env:criticalBatteryAction -and $env:criticalBatteryAction -notlike \"null\") { $CriticalAction = $env:criticalBatteryAction }\r\n    if ($env:lowBatteryAction -and $env:lowBatteryAction -notlike \"null\") { $LowAction = $env:lowBatteryAction }\r\n    if ($env:criticalBatteryLevel -and $env:criticalBatteryLevel -notlike \"null\") { $CriticalLevel = $env:criticalBatteryLevel }\r\n    if ($env:lowBatteryLevel -and $env:lowBatteryLevel -notlike \"null\") { $LowLevel = $env:lowBatteryLevel }\r\n    if ($env:lowNotification -and $env:lowNotification -notlike \"null\") {\r\n        switch ($env:lowNotification) {\r\n            \"Enable\" { $LowNotify = $True }\r\n            \"Disable\" { $LowNoNotify = $True }\r\n        }\r\n    }\r\n\r\n    if ($ScreenTimeout) { [int]$ScreenTimeoutValue = [int]$ScreenTimeout * 60 }\r\n    if ($HibernateTimeout) { [int]$HibernateTimeoutValue = [int]$HibernateTimeout * 60 }\r\n    if ($SleepTimeout) { [int]$SleepTimeoutValue = [int]$SleepTimeout * 60 }\r\n    if ($DiskTimeout) { [int]$DiskTimeoutValue = [int]$DiskTimeout * 60 }\r\n    if ($CriticalLevel){ [int]$CriticalLevelValue = [int]$CriticalLevel }\r\n    if ($LowLevel){ [int]$LowLevelValue = [int]$LowLevel }\r\n\r\n    # Elevation Test\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    if (\r\n        -not $ScreenTimeout -and -not $HibernateTimeout -and -not $SleepTimeout -and -not $DiskTimeout -and -not $PowerPlan -and\r\n        -not $LidAction -and -not $AllowWakeTimers -and -not $DisableWakeTimers -and -not $EnableUSBSuspend -and\r\n        -not $DisableUSBSuspend -and -not $CriticalAction -and -not $LowAction -and -not $CriticalLevel -and\r\n        -not $LowLevel -and -not $LowNotify -and -not $LowNoNotify\r\n    ) {\r\n        Write-Error -Message '[Error] No action given!'\r\n        exit 1\r\n    }\r\n    \r\n    # Check for battery and whether or not the device is a laptop\r\n    if ($PSVersionTable.PSVersion.Major -lt 5) {\r\n        $BatteryCheck = @(Get-WmiObject -Class Win32_Battery).Count -gt 0\r\n        $LaptopCheck = Get-WmiObject -Class win32_systemenclosure | Where-Object { $_.chassistypes -eq 9 -or $_.chassistypes -eq 10 -or $_.chassistypes -eq 14 }\r\n    }\r\n    else {\r\n        $BatteryCheck = @(Get-CimInstance -Class Win32_Battery).Count -gt 0\r\n        $LaptopCheck = Get-CimInstance -Class win32_systemenclosure | Where-Object { $_.chassistypes -eq 9 -or $_.chassistypes -eq 10 -or $_.chassistypes -eq 14 }\r\n    }\r\n    \r\n    # Function to test if policy was set correctly\r\n    function Test-PowerValue {\r\n        [CmdletBinding()]\r\n        param(\r\n            [Parameter()]\r\n            [String]$GUID,\r\n            [Parameter()]\r\n            [String]$Index,\r\n            [Parameter()]\r\n            [int]$Value,\r\n            [Parameter()]\r\n            [String]$Setting\r\n        )\r\n\r\n        # LidAction shows no information so we'll issue a warning and then exit the test function.\r\n        if ($GUID -eq \"SUB_BUTTONS\" -and $Index -eq \"5ca83367-6e45-459f-a27b-476b1d01c936\") {\r\n            Write-Warning \"Unable to verify LidAction via script.\"\r\n            break\r\n        }\r\n\r\n        # Values are stored in hex so we'll need to convert it.\r\n        $Hex = \"0x\" + '{0:X8}' -f $Value\r\n\r\n        $PowerQuery = powercfg.exe \/QUERY SCHEME_CURRENT $GUID | Out-String\r\n        $RelevantSetting = $PowerQuery -split \"Power Setting GUID:\" | Where-Object { $_ -like \"*$Index*\" }\r\n        if (-not ($RelevantSetting)) {\r\n            Write-Warning \"Unable to verify setting for $GUID $Index. This option may not exist for this machine.\"\r\n            break\r\n        }\r\n\r\n        # Depending on how the script was ran we'll need to verify in different ways (ex. its on a laptop or only AC was specified)\r\n        if ($AC -or -not $BatteryCheck) {\r\n            $ACQuery = $RelevantSetting -split 's{2}' | Where-Object { $_ -eq \"Current AC Power Setting Index: $Hex\" }\r\n\r\n            # Actual check code is really similar though (only difference is AC vs DC).\r\n            if (-not $ACQuery) {\r\n                Write-Warning \"AC Value of $Hex Not Found for $GUID $Index. You may want to verify the results.\"\r\n                break\r\n            }\r\n        }\r\n        elseif ($DC) {\r\n            $BatteryQuery = $RelevantSetting -split 's{2}' | Where-Object { $_ -eq \"Current DC Power Setting Index: $Hex\" }\r\n\r\n            if (-not $BatteryQuery) {\r\n                Write-Warning \"DC Value of $Hex Not Found for $GUID $Index. You may want to verify the results.\"\r\n                break\r\n            }\r\n        }\r\n        else {\r\n            $BatteryQuery = $RelevantSetting -split 's{2}' | Where-Object { $_ -eq \"Current DC Power Setting Index: $Hex\" }\r\n            if (-not $BatteryQuery) {\r\n                Write-Warning \"DC Value of $Hex Not Found for $GUID $Index. You may want to verify the results.\"\r\n                break\r\n            }\r\n\r\n            $ACQuery = $RelevantSetting -split 's{2}' | Where-Object { $_ -eq \"Current AC Power Setting Index: $Hex\" }\r\n            if (-not $ACQuery) {\r\n                Write-Warning \"AC Value of $Hex Not Found for $GUID $Index. You may want to verify the results.\"\r\n                break\r\n            }\r\n        }\r\n\r\n        Write-Host \"Successfully set power setting for $Setting!\"\r\n    }\r\n    function Set-PowerAction {\r\n        [CmdletBinding()]\r\n        param(\r\n            [Parameter()]\r\n            [ValidateSet(\"Nothing\", \"Sleep\", \"Hibernate\", \"ShutDown\")]\r\n            [String]$Action,\r\n            [Parameter()]\r\n            [String]$GUID,\r\n            [Parameter()]\r\n            [String]$Index,\r\n            [Parameter()]\r\n            [String]$Setting\r\n        )\r\n        try {\r\n            switch ($Action) {\r\n                \"Nothing\" {\r\n                    if ($AC -or -not $BatteryCheck) {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 0\r\n                    }\r\n                    elseif ($DC) {\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 0\r\n                    }\r\n                    else {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 0\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 0\r\n                    }\r\n    \r\n                    Test-PowerValue $GUID $Index 0 -Setting $Setting\r\n                }\r\n                \"Sleep\" {\r\n                    if ($AC -or -not $BatteryCheck) {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 1\r\n                    }\r\n                    elseif ($DC) {\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 1\r\n                    }\r\n                    else {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 1\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 1\r\n                    }\r\n    \r\n                    Test-PowerValue $GUID $Index 1 -Setting $Setting\r\n                }\r\n                \"Hibernate\" {\r\n                    if ($AC -or -not $BatteryCheck) {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 2\r\n                    }\r\n                    elseif ($DC) {\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 2\r\n                    }\r\n                    else {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 2\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 2\r\n                    }\r\n    \r\n                    Test-PowerValue $GUID $Index 2 -Setting $Setting\r\n                }\r\n                \"Shutdown\" {\r\n                    if ($AC -or -not $BatteryCheck) {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 3\r\n                    }\r\n                    elseif ($DC) {\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 3\r\n                    }\r\n                    else {\r\n                        powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index 3\r\n                        powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index 3\r\n                    }\r\n    \r\n                    Test-PowerValue $GUID $Index 3 -Setting $Setting\r\n                }\r\n                default {\r\n                    throw \"$Action is not a valid action for $Setting, valid actions are Shutdown, Hibernate, Sleep and Nothing.\"\r\n                }\r\n            }\r\n        }\r\n        catch {\r\n            Write-Warning $_.Exception.Message\r\n            Write-Warning \"Failed to set power setting for $Setting\"\r\n        }\r\n    }\r\n\r\n    # The actual code required to set these values is very similar.\r\n    function Set-PowerValue {\r\n        [CmdletBinding()]\r\n        param(\r\n            [Parameter()]\r\n            [String]$Value,\r\n            [Parameter()]\r\n            [String]$GUID,\r\n            [Parameter()]\r\n            [String]$Index,\r\n            [Parameter()]\r\n            [String]$Setting\r\n        )\r\n\r\n        try {\r\n            if ($AC -or -not $BatteryCheck) {\r\n                powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index $Value\r\n            }\r\n            elseif ($DC) {\r\n                powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index $Value\r\n            }\r\n            else {\r\n                powercfg.exe \/SETACVALUEINDEX SCHEME_CURRENT $GUID $Index $Value\r\n                powercfg.exe \/SETDCVALUEINDEX SCHEME_CURRENT $GUID $Index $Value\r\n            }\r\n\r\n            Test-PowerValue $GUID $Index $Value -Setting $Setting\r\n        }\r\n        catch {\r\n            Write-Warning $_.Exception.Message\r\n            Write-Warning \"Failed to set power setting for $Setting\"\r\n        }\r\n    }\r\n\r\n    # Before changing the power plan we should check if it exists and whether or not it is in use.\r\n    function Get-PowerPlan {\r\n        [CmdletBinding()]\r\n        param(\r\n            [Parameter()]\r\n            [Switch]$Active,\r\n            [Parameter()]\r\n            [String]$Name\r\n        )\r\n        if ($Active) {\r\n            $PowerPlan = powercfg.exe \/getactivescheme\r\n            $PowerPlan = ($PowerPlan -replace \"Power Scheme GUID:\" -split \"(?=S{8}-S{4}-S{4}-S{17})\" -split '(' -replace ')') | Where-Object { $_ -ne \" \" }\r\n            $PowerPlan = @(\r\n                [PSCustomObject]@{\r\n                    Name = $($PowerPlan | Where-Object { $_ -notmatch \"S{8}-S{4}-S{4}-S{17}\" })\r\n                    GUID = $($PowerPlan | Where-Object { $_ -match \"S{8}-S{4}-S{4}-S{17}\" })\r\n                }\r\n            )\r\n        }\r\n        else {\r\n            $PowerPlan = powercfg.exe \/L\r\n            $PowerPlan = $PowerPlan -replace 's{2,}', ',' -replace ' *', ',True' -replace \"Existing Power Schemes (* Active)\", \"GUID,Name,Active\" -replace \"-{2,}\" -replace \"Power Scheme GUID: \" -replace '(' -replace ')' | Where-Object { $_ } | ConvertFrom-Csv\r\n        }\r\n\r\n        if ($Name) {\r\n            $PowerPlan | Where-Object { $_.Name -like $Name }\r\n        }\r\n        else {\r\n            $PowerPlan\r\n        }\r\n    }\r\n}\r\nprocess {\r\n    # If not elevated, exit the script.\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    # If a power plan was specified, let the user know that this might not actually be a changeable option (depending on computer age).\r\n    if ($PowerPlan) {\r\n        Write-Warning \"Devices with modern standby might only have `\"Balanced`\" as an option.\"\r\n        Write-Warning \"Link: https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/power\/power-policy-settings\"\r\n\r\n        $TargetPlan = Get-PowerPlan -Name $PowerPlan\r\n        # If totally not available we're going to exit as all these settings are tied to the active power plan. \r\n        # If we're not able to set it we'll want to give an opportunity to correct the error.\r\n        if ($null -eq $TargetPlan) {\r\n            Write-Error \"Your targeted Power Plan is not available.\"\r\n            exit 1\r\n        }\r\n\r\n        if ($TargetPlan.Active -ne $True) {\r\n            powercfg.exe \/setactive $TargetPlan.GUID\r\n        }\r\n\r\n        $CurrentPlan = Get-PowerPlan -Active\r\n        if ($CurrentPlan.GUID -notlike \"*$($TargetPlan.GUID)*\") {\r\n            Write-Error \"Failed to change power plan!\"\r\n            exit 1\r\n        }\r\n        else {\r\n            Write-Host \"Successfully set Power Plan!\"\r\n        }\r\n    }\r\n\r\n    # We're going to run through all the various options and if requested we'll adjust them.\r\n    if ($ScreenTimeout) { Set-PowerValue -GUID \"SUB_VIDEO\" -Index \"3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e\" -Value $ScreenTimeoutValue -Setting \"Screen Timeout\" }\r\n    if ($HibernateTimeout) { \r\n        Write-Warning \"Hibernate timeout is not supported by all devices and may be ignored by the System.\" \r\n        Set-PowerValue -GUID \"SUB_SLEEP\" -Index \"9d7815a6-7ee4-497e-8888-515a05f02364\" -Value $HibernateTimeoutValue -Setting \"Hibernate Timeout\"\r\n    }\r\n    if ($SleepTimeout) { Set-PowerValue -GUID \"SUB_SLEEP\" -Index \"29f6c1db-86da-48c5-9fdb-f2b67b1f44da\" -Value $SleepTimeoutValue -Setting \"Sleep Timeout\" }\r\n    if ($DiskTimeout) { \r\n        Write-Warning \"An HDD is required for this setting to display (has no effect on SSDs).\"\r\n        Set-PowerValue -GUID \"SUB_DISK\" -Index \"6738e2c4-e8a5-4a42-b16a-e040e769756e\" -Value $DiskTimeoutValue -Setting \"Disk Timeout\"\r\n    }\r\n    if ($DisableUSBSuspend) { Set-PowerValue -GUID \"2a737441-1930-4402-8d77-b2bebba308a3\" -Index \"48e6b7a6-50f5-4782-a5d4-53bb8f07e226\" -Value 0 -Setting \"Disable USB Auto-Suspend\" }\r\n    if ($EnableUSBSuspend) { Set-PowerValue -GUID \"2a737441-1930-4402-8d77-b2bebba308a3\" -Index \"48e6b7a6-50f5-4782-a5d4-53bb8f07e226\" -Value 1 -Setting \"Enable USB Auto-Suspend\" }\r\n    if ($AllowWakeTimers) { Set-PowerValue -GUID \"SUB_SLEEP\" -Index \"bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d\" -Value 1 -Setting \"Allow Wake Timers\" }\r\n    if ($DisableWakeTimers) { Set-PowerValue -GUID \"SUB_SLEEP\" -Index \"bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d\" -Value 0 -Setting \"Disable Wake Timers\" }\r\n    # Lid Action has slightly different options than Set-PowerAction.\r\n    if ($LidAction -and $LaptopCheck) { \r\n        switch ($LidAction) {\r\n            \"Nothing\" { Set-PowerValue -GUID \"SUB_BUTTONS\" -Index \"5ca83367-6e45-459f-a27b-476b1d01c936\" -Value 0 -Setting \"Lid Action\" }\r\n            \"Sleep\" { Set-PowerValue -GUID \"SUB_BUTTONS\" -Index \"5ca83367-6e45-459f-a27b-476b1d01c936\" -Value 1 -Setting \"Lid Action\" }\r\n            \"Shutdown\" { Set-PowerValue -GUID \"SUB_BUTTONS\" -Index \"5ca83367-6e45-459f-a27b-476b1d01c936\" -Value 3 -Setting \"Lid Action\" }\r\n            default {\r\n                Write-Error \"Invalid PowerButton Option. Only Sleep, Nothing and Shutdown are allowed!\"\r\n                exit 1\r\n            }\r\n        } \r\n    }\r\n    if ($CriticalAction) { \r\n        Set-PowerAction -GUID \"SUB_BATTERY\" -Index \"637ea02f-bbcb-4015-8e2c-a1c7b9c0b546\" -Action $CriticalAction -Setting \"Critical Battery Action\"\r\n    }\r\n    if ($LowAction) { \r\n        Set-PowerAction -GUID \"SUB_BATTERY\" -Index \"d8742dcb-3e6a-4b3c-b3fe-374623cdcf06\" -Action $LowAction -Setting \"Low Battery Action\"\r\n    }\r\n    if ($CriticalLevel) { Set-PowerValue -GUID \"SUB_BATTERY\" -Index \"9a66d8d7-4ff7-4ef9-b5a2-5a326ca2a469\" -Value $CriticalLevelValue -Setting \"Critical Battery Level\" }\r\n    if ($LowLevel) { Set-PowerValue -GUID \"SUB_BATTERY\" -Index \"8183ba9a-e910-48da-8769-14ae6dc1170a\" -Value $LowLevelValue -Setting \"Low Battery Level\" }\r\n    if ($LowNoNotify) { Set-PowerValue -GUID \"SUB_BATTERY\" -Index \"bcded951-187b-4d05-bccc-f7e51960c258\" -Value 0 -Setting \"Disable Low Battery Notification\" }\r\n    if ($LowNotify) { Set-PowerValue -GUID \"SUB_BATTERY\" -Index \"bcded951-187b-4d05-bccc-f7e51960c258\" -Value 1 -Setting \"Enable Low Battery Notification\" }\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\/freetrialform\/\">Obtenir l&rsquo;acc\u00e8s<\/a><\/p>\n<\/div>\n<h2>Description d\u00e9taill\u00e9e<\/h2>\n<p>Le script est un outil polyvalent qui permet de r\u00e9gler diff\u00e9rents param\u00e8tres d&rsquo;alimentation. Il commence par la d\u00e9finition des param\u00e8tres, ce qui permet aux utilisateurs de sp\u00e9cifier des valeurs pour le d\u00e9lai d&rsquo;attente de l&rsquo;\u00e9cran, l&rsquo;hibernation, le d\u00e9lai de mise en veille, le d\u00e9lai d&rsquo;attente du disque, et bien plus. Des variables environnementales peuvent \u00eatre d\u00e9finies pour chaque param\u00e8tre, ce qui offre souplesse et facilit\u00e9 d&rsquo;utilisation. Le script comprend une s\u00e9rie de fonctions permettant de v\u00e9rifier les capacit\u00e9s du syst\u00e8me, de v\u00e9rifier si un changement de param\u00e8tre a \u00e9t\u00e9 effectu\u00e9 avec succ\u00e8s et d&rsquo;appliquer les modifications.<\/p>\n<p>Par exemple, si un administrateur informatique souhaite modifier le d\u00e9lai d&rsquo;attente de l&rsquo;\u00e9cran, il peut passer le param\u00e8tre <strong>ScreenTimeout<\/strong> avec la valeur de d\u00e9lai souhait\u00e9e en secondes. Le script convertit ensuite cette valeur dans le format appropri\u00e9 et l&rsquo;applique au syst\u00e8me \u00e0 l&rsquo;aide de la commande <strong>powercfg.exe.<\/strong> <\/p>\n<p>Cette approche est reproduite dans divers param\u00e8tres, tels que l&rsquo;hibernation, le d\u00e9lai de mise en veille et le d\u00e9lai d&rsquo;attente sur le disque. Le script permet \u00e9galement de configurer les plans d&rsquo;alimentation et les options de suspension USB, qui sont essentiels pour g\u00e9rer la consommation d&rsquo;\u00e9nergie et les performances de l&rsquo;appareil.<\/p>\n<h2>Cas d&rsquo;utilisation potentiels<\/h2>\n<p>Imaginez une entreprise MSP qui g\u00e8re un parc d&rsquo;ordinateurs portables pour le compte d&rsquo;une entreprise. Elle doit s&rsquo;assurer que tous les appareils passent en mode d&rsquo;\u00e9conomie d&rsquo;\u00e9nergie apr\u00e8s une p\u00e9riode d&rsquo;inactivit\u00e9 sp\u00e9cifique, sans intervention manuelle. En d\u00e9ployant ce script, l&rsquo;entreprise MSP peut configurer \u00e0 distance le d\u00e9lai de mise en veille, le d\u00e9lai d&rsquo;hibernation et m\u00eame les param\u00e8tres d&rsquo;action sur tous les appareils, garantissant ainsi l&rsquo;uniformit\u00e9 et le respect des politiques d&rsquo;\u00e9conomie d&rsquo;\u00e9nergie de l&rsquo;entreprise.<\/p>\n<h2>Comparaisons<\/h2>\n<p>Les m\u00e9thodes traditionnelles de gestion des param\u00e8tres d&rsquo;alimentation impliquent souvent des ajustements manuels sur chaque appareil ou le d\u00e9ploiement de strat\u00e9gies de groupe via Active Directory. Bien qu&rsquo;efficaces, ces m\u00e9thodes n&rsquo;ont pas la pr\u00e9cision et la facilit\u00e9 de personnalisation offertes par le script. Gr\u00e2ce \u00e0 cette approche PowerShell, les professionnels de l&rsquo;informatique peuvent adapter les param\u00e8tres \u00e0 des besoins sp\u00e9cifiques et les appliquer de mani\u00e8re plus dynamique \u00e0 diff\u00e9rents groupes d&rsquo;appareils.<\/p>\n<h2>FAQ<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Ce script est-il compatible avec tous les appareils Windows ?<\/strong><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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\">Le script est compatible avec Windows 7 et les versions plus r\u00e9centes. Toutefois, certains param\u00e8tres peuvent ne pas \u00eatre applicables \u00e0 tous les appareils en raison de limitations mat\u00e9rielles.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Ce script peut-il g\u00e9rer les param\u00e8tres d&rsquo;alimentation des appareils qui ne sont pas connect\u00e9s \u00e0 un r\u00e9seau ?<\/strong><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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\">Le script n\u00e9cessite une connectivit\u00e9 r\u00e9seau pour \u00eatre ex\u00e9cut\u00e9 \u00e0 distance sur un appareil. Il est id\u00e9al pour les appareils situ\u00e9s dans un r\u00e9seau d&rsquo;entreprise ou connect\u00e9s via un VPN.<\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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>Comment ce script garantit-il que les changements sont appliqu\u00e9s avec succ\u00e8s ?<\/strong><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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\">Il comprend des fonctions permettant de v\u00e9rifier si les param\u00e8tres appliqu\u00e9s sont correctement d\u00e9finis et de fournir un retour d&rsquo;information sur le succ\u00e8s ou l&rsquo;\u00e9chec de l&rsquo;op\u00e9ration.<\/li>\n<\/ul>\n<h2>Implications<\/h2>\n<p>Bien que ce script facilite grandement la gestion de l&rsquo;\u00e9nergie, une utilisation incorrecte peut avoir des cons\u00e9quences inattendues, comme la mise en veille pr\u00e9matur\u00e9e du syst\u00e8me ou l&rsquo;hibernation, ce qui peut perturber des processus importants. Il est essentiel de tester le script dans un environnement contr\u00f4l\u00e9 avant de le d\u00e9ployer \u00e0 grande \u00e9chelle.<\/p>\n<h2>Recommandations<\/h2>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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\">Sauvegardez toujours les param\u00e8tres d&rsquo;alimentation actuels avant d&rsquo;appliquer de nouvelles configurations.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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\">Testez le script sur un petit nombre d&rsquo;appareils avant de le d\u00e9ployer compl\u00e8tement.<\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559684&quot;:-2,&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\">Mettez r\u00e9guli\u00e8rement \u00e0 jour le script pour tenir compte des nouvelles mises \u00e0 jour et fonctionnalit\u00e9s de Windows.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>\u00c0 une \u00e9poque o\u00f9 la gestion \u00e0 distance et l&rsquo;automatisation sont essentielles, des outils comme NinjaOne sont devenus inestimables. NinjaOne offre de solides capacit\u00e9s de <a href=\"https:\/\/www.ninjaone.com\/rmm\/\">surveillance et de gestion \u00e0 distance<\/a>, compl\u00e9tant les scripts de ce type en fournissant une plateforme pour le d\u00e9ploiement, la surveillance et la gestion des actifs informatiques. L&rsquo;int\u00e9gration de ces scripts dans un cadre de gestion informatique plus large comme <a href=\"https:\/\/www.ninjaone.com\/efficiency\/\">NinjaOne peut am\u00e9liorer l&rsquo;efficacit\u00e9<\/a>, r\u00e9duire la charge de travail manuelle et contribuer \u00e0 une strat\u00e9gie de gestion informatique plus proactive.<\/p>\n","protected":false},"author":35,"featured_media":193882,"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":[4287],"class_list":["post-269478","script_hub","type-script_hub","status-publish","has-post-thumbnail","hentry","script_hub_category-windows"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/script_hub\/269478","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=269478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media\/193882"}],"wp:attachment":[{"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/media?parent=269478"}],"wp:term":[{"taxonomy":"script_hub_category","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/operating_system?post=269478"},{"taxonomy":"use_cases","embeddable":true,"href":"https:\/\/www.ninjaone.com\/fr\/wp-json\/wp\/v2\/use_cases?post=269478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}