Added Enable WOL to Deploy
This commit is contained in:
parent
ab4ed531e6
commit
022a25e5a7
37
Patches/Windows/Enable-WOL.ps1
Normal file
37
Patches/Windows/Enable-WOL.ps1
Normal file
@ -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
|
||||||
|
}
|
||||||
@ -81,6 +81,10 @@ echo Adding Group Policy to All Users...
|
|||||||
C:\Scripts\Patches\GroupPolicy\LGPO.exe /g C:\Scripts\Patches\GroupPolicy\
|
C:\Scripts\Patches\GroupPolicy\LGPO.exe /g C:\Scripts\Patches\GroupPolicy\
|
||||||
echo Successfully Applied Policy...
|
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
|
:: Copy Login Scripts to User Startup
|
||||||
echo Copying Login Scripts to All Users...
|
echo Copying Login Scripts to All Users...
|
||||||
powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup'
|
powershell Copy-Item 'C:\Scripts\TCSE-Login.vbs' 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user