Update and rename SetHypervisoLaunch.ps1 to SetHypervisorLaunch.ps1

This commit is contained in:
Mathieu Moran
2022-10-13 21:47:09 -04:00
committed by GitHub
parent 0dc7da03db
commit 391a19686f
2 changed files with 31 additions and 31 deletions
-31
View File
@@ -1,31 +0,0 @@
Write-Host "[1] Set hypervisor launch option to auto (Hyper-V)"
Write-Host "[2] Set hypervisor launch option to off (VMWare)"
$a = Read-Host -Prompt "Type your choice"
$systemcheck = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if ($systemcheck) {
if ($a -eq 1) {
Write-Host "[+] doing 'bcdedit /set hypervisorlaunchtype auto' command"
bcdedit /set hypervisorlaunchtype auto
$prompt = Read-Host -Prompt "[+} do you want to reboot? (y/n)"
if ($prompt -eq "y") {
Write-Host " [+] rebooting"
restart-computer -Confirm
}
}
elseif ($a -eq 2) {
Write-Host "[+] doing 'bcdedit /set hypervisorlaunchtype off' command"
bcdedit /set hypervisorlaunchtype off
$prompt = Read-Host -Prompt "[+} do you want to reboot? (y/n)"
if ($prompt -eq "y") {
Write-Host " [+] rebooting"
restart-computer -Confirm
}
}
}
else
{
Write-Host "[+] not admin :("
}
+31
View File
@@ -0,0 +1,31 @@
Write-Host "[1] Set hypervisor launch option to auto (Hyper-V)"
Write-Host "[2] Set hypervisor launch option to off (VMWare)"
$a = Read-Host -Prompt "Type your choice"
$hvType = @('auto', 'off')
$selType
$sysCheck = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if ($sysCheck) {
if ($a -eq 1) {
$selType = $hvType[0]
}
elseif ($a -eq 2) {
$selType = $hvType[1]
}
if ($selType -eq 'auto' -or $selType -eq 'off')
{
Write-Host "[+] doing 'bcdedit /set hypervisorlaunchtype $selType' command"
bcdedit /set hypervisorlaunchtype $selType
$prompt = Read-Host -Prompt "[+] do you want to reboot? (y/n)"
if ($prompt -eq "y") {
Write-Host " [+] rebooting"
restart-computer -Confirm
}
}
}
else
{
Write-Host "[+] not admin :("
}