How to stop computer from sleeping


This is a very generic post, but I felt though this is small thing but can be of good use. So, many times we do run the PowerShell scripts or some processing on our local computer and it is blocked due to the system entering into sleep mode.

Due to which the process gets stopped. There are third-party apps for this but do not rely on installing many 3rd party apps to my system. So I found the script which does the job for me. I know what's written in the script so I am confident while running this script.

Here is the script,

$myshell = New-Object -com "Wscript.Shell"

while ($true) {
    Write-Host ([char]9829-ForegroundColor Red -NoNewline
    Start-Sleep -Seconds 300

Hope this will help you as well, do comment and share if you like it.

Happy Coding..!!

Sumit Kanchan


Popular posts from this blog

Rename Folder using Microsoft Flow / Power Automate in a Document Library in SharePoint Online

Power Automate: How to Add "New Line" to the text in SharePoint multiline text field

Power Automate: Rename file in SharePoint Online