diff --git a/Patches/Windows/Enable-WOL.ps1 b/Patches/Windows/Enable-WOL.ps1 new file mode 100644 index 0000000..9090090 --- /dev/null +++ b/Patches/Windows/Enable-WOL.ps1 @@ -0,0 +1,37 @@ +# Get all physical network adapters and their WOL-related properties +$wolStatus = Get-NetAdapter -Physical | Get-NetAdapterAdvancedProperty | Where-Object { + ($_.DisplayName -like '*WOL*') -or ($_.DisplayName -like '*Wake*') +} + +# Function to check if WOL is disabled for any adapter +function Test-WolDisabled { + param($wolProperties) + + foreach ($property in $wolProperties) { + # Check if the property is disabled or set to 0 + if ($property.DisplayValue -eq 'Disabled' -or $property.DisplayValue -eq '0') { + return $true + } + } + return $false +} + +# Get all physical adapters for reference +$physicalAdapters = Get-NetAdapter -Physical + +# Check if WOL is disabled on any adapter +if (Test-WolDisabled -wolProperties $wolStatus) { + Write-Host "Wake on Magic Packet is disabled on one or more adapters. Enabling..." + + # Enable WOL features for all physical adapters + try { + $physicalAdapters | Set-NetAdapterPowerManagement -WakeOnMagicPacket Enabled -WakeOnPattern Enabled + Write-Host "Successfully enabled Wake on Magic Packet for all physical adapters." -ForegroundColor Green + } + catch { + Write-Host "Error enabling Wake on Magic Packet: $($_.Exception.Message)" -ForegroundColor Red + } +} +else { + Write-Host "Wake on Magic Packet is already enabled on all adapters." -ForegroundColor Green +} \ No newline at end of file diff --git a/TCSE-Computer-Deploy.bat b/TCSE-Computer-Deploy.bat index 7e5252e..848c005 100644 --- a/TCSE-Computer-Deploy.bat +++ b/TCSE-Computer-Deploy.bat @@ -81,6 +81,10 @@ echo Adding Group Policy to All Users... C:\Scripts\Patches\GroupPolicy\LGPO.exe /g C:\Scripts\Patches\GroupPolicy\ echo Successfully Applied Policy... +:: Enable Wake on LAN +echo Checking Wake on LAN... +powershell -ExecutionPolicy Bypass -File "C:\Scripts\Patches\Windows\Enable-WOL.ps1" + :: Copy Login Scripts to User Startup echo Copying Login Scripts to All Users... powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup'