Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Needs http://prozandcoms.stefanoz.com/setconsole-exe-console-window-control/ to be placed in %windir%\System32
- # Batch file inside Start Menu -> Run -> shell:startup
- setconsole /hide
- %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Users\dbieg\Documents\startup.ps1"
- # PowerShell Script
- Start-Process -FilePath "C:\Program Files (x86)\AEM\Infinity Tuner\InfinityTuner.exe"
- Register-WMIEvent -query "Select * From Win32_PowerManagementEvent" `
- -SourceIdentifier "PowerEvents" `
- -action {
- if ( ! [BOOL](Get-WmiObject -Class BatteryStatus -Namespace root\wmi).PowerOnLine ){
- # Device is unplugged
- write-host "Unplugged. Shutting down..."
- Stop-Computer -ComputerName localhost
- }
- }
- Wait-Event -SourceIdentifier "PowerEvents"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement