Skip to content

Instantly share code, notes, and snippets.

@PapeCoding
Last active March 9, 2021 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PapeCoding/18002afa821d7c8b2b213f0365a19c30 to your computer and use it in GitHub Desktop.
Save PapeCoding/18002afa821d7c8b2b213f0365a19c30 to your computer and use it in GitHub Desktop.
Toggle HyperV for the FACEIT Anti-Cheat
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{ Write-Host "No Adminrights. restart as Administrator"
$arguments = "& ‚" + $myinvocation.mycommand.definition + "‚"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
$oldValue = (bcdedit | Select-String -Pattern "hypervisorlaunchtype").toString().split() | select -Last 1
If ( $oldValue -eq "Off")
{
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /f
bcdedit /set hypervisorlaunchtype "Auto"
echo "Activated HyperV."
}
Else
{
reg add "HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity" /v "Enabled" /t REG_DWORD /d 0 /f
bcdedit /set hypervisorlaunchtype "Off"
echo "Deactivated HyperV."
}
read-host "Press ENTER to continue..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment