Last active
January 18, 2022 17:01
-
-
Save lanzorg/de4415cdaefa291dc4a7b30fde422ed4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-SendKeys { | |
param ( | |
[string] $Keys, | |
[string] $Title | |
) | |
$wshell = New-Object -ComObject wscript.shell; | |
if ($Title) { $wshell.AppActivate($Title) } | |
Start-Sleep -Seconds 1 | |
if ($Keys) { $wshell.SendKeys($Keys) } | |
} | |
function Restart-WithElevation { | |
if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S-1-5-32-544')) { | |
$current = "$($script:MyInvocation.MyCommand.Path)" | |
$command = "powershell -ExecutionPolicy Bypass -NoExit -NoLogo -File `"$current`"" | |
if (Get-Command "wt" -ErrorAction SilentlyContinue) { | |
$persona = Get-Item -Path $current | Select-Object -ExpandProperty BaseName | |
$command = "nt -d `"$PSScriptRoot`" --title `"$persona`" $command" | |
Start-Process -FilePath "wt" -ArgumentList "$command" -Verb RunAs ; Exit | |
} | |
Start-Process -FilePath "powershell" -ArgumentList "$command" -Verb RunAs ; Exit | |
} | |
} | |
if ($MyInvocation.InvocationName -ne '.') { | |
Restart-WithElevation | |
Clear-Host | |
Write-Host "+------------------------------------------------------------------------------+" | |
Write-Host "| |" | |
Write-Host "| > WINBATOR |" | |
Write-Host "| |" | |
Write-Host "| > WINDOWS POST INSTALLATION SCRIPT |" | |
Write-Host "| |" | |
Write-Host "| > https://notabug.org/foozoor/winbator |" | |
Write-Host "| |" | |
Write-Host "+------------------------------------------------------------------------------+" | |
Write-Host "`nThe script is executing, please be patient..." -NoNewline | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Start-Sleep -Milliseconds 100 | |
Write-Host "`rThe script was executed successfully, press ENTER to exit." -NoNewline | |
Read-Host | |
# Invoke-SendKeys "%{f4}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment