Advertisement
s3c70r

AEM Infinity PowerShell Tablet Script

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