Zuletzt geändert von David Haido am 2022/03/23 11:22

Von Version 3.3
bearbeitet von Michael Ecer
am 2022/03/08 09:19
Änderungskommentar: Update document after refactoring.
Auf Version 2.1
bearbeitet von Michael Ecer
am 2022/02/18 13:20
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Zusammenfassung

Details

Seiteneigenschaften
Inhalt
... ... @@ -11,7 +11,7 @@
11 11  \\<#
12 12   .SYNOPSIS
13 13   Enable WakeOnLan on all supported physical NICs
14 -
14 +
15 15   .DESCRIPTION
16 16   Enable WakeOnLan on all supported physical NICs via cmdlet Set-NetAdapterPowerManagement
17 17  \\ .PARAMETER WhatIf
... ... @@ -41,3 +41,44 @@
41 41  }
42 42  \\EnableWOL -DryRun $WhatIf##
43 43  )))
44 +
45 +
46 +(% style="color:#000000" %)Energieeinstellungen für Netzwerkadapter deaktivieren
47 +
48 +(% class="box" %)
49 +(((
50 +(% style="color:#000000" %)###Requires -Version 3
51 +\\<#
52 + .SYNOPSIS
53 + Disable power management on all supported physical NICs
54 +
55 + .DESCRIPTION
56 + Disable power management on all supported physical NICs via cmdlet Set-NetAdapterPowerManagement
57 +\\ .PARAMETER WhatIf
58 + Check for supported ethernet adapters without applying actual changes
59 +\\ .NOTES
60 + Version: 1.0
61 + Author: cge@sbe.de
62 + Creation Date: 03.11.2021
63 +\\ .LINK
64 + https:~/~/sbe.de
65 +\\ .EXAMPLE
66 + C:\PS> $MyInvocation.MyCommand.Name
67 +\\#>
68 +\\Param (
69 + [Parameter(Mandatory = $false)]
70 + [Switch]$WhatIf
71 +)
72 +\\$ErrorActionPreference = "SilentlyContinue"
73 +\\function DisableNetworkPowerManagement([Bool]$DryRun = $False) {
74 + if ($DryRun) { $DryRun_Hint = "[DRYRUN] " }
75 + Get-NetAdapter -Physical | Get-NetAdapterPowerManagement | Where-Object -FilterScript {$_.AllowComputerToTurnOffDevice -ne "Unsupported"} | ForEach-Object {
76 + Write-Host ("{0}Disable power management on ethernet adapter '{1}'" -f $DryRun_Hint, $_.InterfaceDescription)
77 + if (-not $DryRun) {
78 + $_.AllowComputerToTurnOffDevice = "Disabled"
79 + $_ | Set-NetAdapterPowerManagement
80 + }
81 + }
82 +}
83 +\\DisableNetworkPowerManagement -DryRun $WhatIf##
84 +)))