-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeep-awake.ps1
More file actions
28 lines (23 loc) · 952 Bytes
/
Copy pathkeep-awake.ps1
File metadata and controls
28 lines (23 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<#
.SYNOPSIS
Script simples para manter o computador ativo simulando uma tecla fantasma.
.DESCRIPTION
Este script utiliza o WScript.Shell para enviar a tecla F15 a cada 60 segundos.
A tecla F15 geralmente não tem função atribuída em teclados modernos,
o que previne o bloqueio de tela sem interferir na digitação do usuário.
.NOTES
Para parar o script, pressione CTRL + C no terminal.
#>
Write-Host "=========================================="
Write-Host " Keep Awake - STATUS: ATIVO"
Write-Host "=========================================="
Write-Host "O script enviará um sinal a cada 60 segundos."
Write-Host "Pressione CTRL + C para encerrar."
Write-Host ""
$WShell = New-Object -ComObject WScript.Shell
while ($true) {
$WShell.SendKeys("{F15}")
$Timestamp = Get-Date -Format "HH:mm:ss"
Write-Host "[$Timestamp] Sinal de atividade enviado..." -ForegroundColor DarkGray
Start-Sleep -Seconds 60
}