From 0dc7da03dbc0a8ef799a7f725b515583c33e1e1c Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Wed, 12 Oct 2022 15:12:25 -0400 Subject: [PATCH] Create SetHypervisoLaunch.ps1 --- SetHypervisoLaunch.ps1 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 SetHypervisoLaunch.ps1 diff --git a/SetHypervisoLaunch.ps1 b/SetHypervisoLaunch.ps1 new file mode 100644 index 0000000..ff76440 --- /dev/null +++ b/SetHypervisoLaunch.ps1 @@ -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" + +$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 :(" +}