- PowerShell 89.3%
- Python 10.7%
| raspberry_pi_pico | Update raspberry_pi_pico/wake_from_sleep.py | |
| WiFi | WiFi monitor scripts from Chris/GertJan | |
| bug_report.md | Mention that bug can occur when Wi-Fi roaming and that reason for indeterministic nature of bug is not yet known | |
| ping.ps1 | simple ping with timestamp in powershell | |
| ping2.ps1 | new ping with packtloss stats | |
| psshutdown.exe | Rewrite sleep and check script to work with Pico script | |
| README.md | Prerequisite added | |
| SleepAndCheckLoop.ps1 | added print routing table before and after | |
OpenAI generated scripts
Explanation of the wake-sleep-Script
Display-Error Function:
Utilizes Windows Forms to display a critical error message box if internet connectivity fails after waking up.
Check-Internet Function:
Uses Test-Connection to ping 8.8.8.8 four times. If the ping fails, it calls Display-Error and terminates the script. If the ping is successful, it outputs a message and continues the loop. Schedule-Wake Function:
Task Scheduling:
Creates a scheduled task named WakeAfter10Seconds. The task is scheduled to trigger once at the current time plus 10 seconds. The action is a no-operation PowerShell command (Exit), serving solely to wake the computer.
Wake Settings:
Configures the task to wake the computer if it's asleep. Allows the task to start even if the computer is on battery power.
Error Handling:
If scheduling fails (likely due to insufficient permissions), the script outputs an error message and exits. Sleep-ComputerNow Function: Puts the computer to sleep using rundll32.exe. Alternatively, you can use the Suspend-Computer cmdlet if available and desired.
Infinite Loop:
Continuously performs the scheduling, sleeping, waking, and checking steps. After the computer wakes up, the script waits for 5 seconds to ensure the system is fully operational before performing the internet connectivity check.
###Prerequisite PowerShell.exe -ExecutionPolicy Bypass -File .\SleepAndCheckLoop.ps1
##System Sleep Behavior: Ensure that your system's sleep settings allow wake timers. Verify Wake Timers: Go to Control Panel > Hardware and Sound > Power Options. Click on Change plan settings next to your active power plan. Click on Change advanced power settings. Expand Sleep > Allow wake timers. Set it to Enable for both On battery and Plugged in as needed.