Version 2.1 von Michael Ecer am 2022/02/18 13:20

Zeige letzte Bearbeiter
1 (% style="color:#000000" %)Mit nachfolgendem PowerShell-Skript (abgespeichert unter (% style="color:#2980b9" %)**C:\logoDIDACT\Autorun\setup\10_enable-wol.ps1**(% style="color:#000000" %)) kann sichergestellt werden, dass die WakeOnLAN-Funktion unter Windows für alle Netzwerkadapter aktiviert ist, die diesen Modus unterstützen.
2
3
4 (% style="color:#c0392b" %)__**Wichtig:**__(%%)
5 (% style="color:#000000" %)Es gilt hierbei darauf zu achten, dass die Unterstützung durch den Treiber geliefert wird und daher ein vernünftiger LAN-Treiber passend zum Netzwerkadapter unter Windows 10 (ins Image) installiert werden muss. Der von Microsoft mitgelieferte LAN-Treiber unterstützt WakeOnLAN von Haus aus nicht.
6
7
8 (% class="box" %)
9 (((
10 (% style="color:#000000" %)###Requires -Version 3
11 \\<#
12 .SYNOPSIS
13 Enable WakeOnLan on all supported physical NICs
14
15 .DESCRIPTION
16 Enable WakeOnLan on all supported physical NICs via cmdlet Set-NetAdapterPowerManagement
17 \\ .PARAMETER WhatIf
18 Check for supported ethernet adapters without applying actual changes
19 \\ .NOTES
20 Version: 1.0
21 Author: jm@sbe.de
22 Creation Date: 26.06.2020
23 \\ .LINK
24 https:~/~/sbe.de
25 \\ .EXAMPLE
26 C:\PS> $MyInvocation.MyCommand.Name
27 \\#>
28 \\Param (
29 [Parameter(Mandatory = $false)]
30 [Switch]$WhatIf
31 )
32 \\$ErrorActionPreference = "SilentlyContinue"
33 \\function EnableWOL([Bool]$DryRun = $False) {
34 if ($DryRun) { $DryRun_Hint = "[DRYRUN] " }
35 Get-NetAdapter -Physical -Name Eth* | Get-NetAdapterPowerManagement | Where-Object { $_.WakeOnMagicPacket -ieq "Disabled" } | ForEach-Object {
36 Write-Host ("{0}Enabling WakeOnLan support on ethernet adapter '{1}'" -f $DryRun_Hint, $_.InterfaceDescription)
37 if (-not $DryRun) {
38 Set-NetAdapterPowerManagement -InterfaceDescription $_.InterfaceDescription -WakeOnMagicPacket Enabled
39 }
40 }
41 }
42 \\EnableWOL -DryRun $WhatIf##
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 )))