-
Normally, we would have to run the Python script manually each time. To avoid this, I created a task scheduler script using PowerShell. This PowerShell script ensures the Python script runs in the background every time the computer session starts.
-
You can also create a scheduled task by following the steps of the PowerShell script using Windows' own scheduled tasks settings, without running the PowerShell script itself.
-
Within the websiteBlocker.pyw file, the desired websites to be blocked are added to the website_liste list.
-
The start and end times for blocking the specified websites are written to the baslangicSaati and bitisSaati variables.
-
As an example, I will block Google between 08:00 AM and 06:00 PM.
-
I am creating a scheduled task by running the zamanlanmisGorev.ps1 file I created with PowerShell.
-
After creating the scheduled task, the Python script will run in the background every time a session starts.
-
Upon the next session login, webBlocker activated.
-
As the time was 02:06:09 PM (14:06:09), https://www.google.com, google.com, and www.google.com addresses were added to the hosts file.
- When the time was 09:06:26 PM (21:06:26), https://www.google.com, google.com, and www.google.com addresses were removed from the hosts file.
