-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathRUN-OUTSIDE-VM.ps1
More file actions
3364 lines (2830 loc) · 157 KB
/
RUN-OUTSIDE-VM.ps1
File metadata and controls
3364 lines (2830 loc) · 157 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$scriptPath = $MyInvocation.MyCommand.Path
if ($scriptPath -and (Test-Path $scriptPath)) {
Unblock-File -Path $scriptPath -ErrorAction SilentlyContinue
}
try {
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force -ErrorAction SilentlyContinue
} catch { }
$isAdministrator = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdministrator) {
Write-Warning "Administrator privileges are required for this script."
Write-Host "Attempting to re-launch with elevated privileges..." -ForegroundColor Yellow
try {
$scriptPath = $MyInvocation.MyCommand.Path
$arguments = "-ExecutionPolicy Bypass -NoProfile -File `"$scriptPath`""
Start-Process powershell.exe -ArgumentList $arguments -Verb RunAs -ErrorAction Stop
Exit
}
catch {
Write-Host "[ERROR] Failed to elevate." -ForegroundColor Red
Write-Host "Please start a PowerShell session as an Administrator and run the script manually." -ForegroundColor Red
Write-Host "" -ForegroundColor Red
Write-Host "To run manually:" -ForegroundColor Cyan
Write-Host " 1. Right-click PowerShell → Run as Administrator" -ForegroundColor Gray
Write-Host " 2. Run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass" -ForegroundColor Gray
Write-Host " 3. Run: .\Run-Outside-VM.ps1" -ForegroundColor Gray
if ($Host.UI.RawUI.KeyAvailable) { $Host.UI.RawUI.FlushInputBuffer() }
Write-Host "`nPress any key to exit..."
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-Null
Exit
}
}
Write-Host "Successfully running with Administrator privileges." -ForegroundColor Green
function Get-UserChoice {
param(
[string]$Message,
[string]$Default,
[string]$Description
)
Write-Host "`n # $Message " -NoNewline -ForegroundColor Cyan
Write-Host "[$Default] " -NoNewline -ForegroundColor Yellow
if ($Description) {
Write-Host "($Description)" -ForegroundColor Gray
}
$userInput = Read-Host
if ([string]::IsNullOrWhiteSpace($userInput)) {
return $Default
}
return $userInput
}
function Get-YesNoChoice {
param(
[string]$Message,
[string]$Default = "Y",
[string]$Description
)
do {
Write-Host "`n # $Message (Y/N) " -NoNewline -ForegroundColor Cyan
Write-Host "[$Default] " -NoNewline -ForegroundColor Yellow
if ($Description) {
Write-Host "($Description)" -ForegroundColor Gray
}
$userInput = Read-Host
if ([string]::IsNullOrWhiteSpace($userInput)) {
$userInput = $Default
}
$userInput = $userInput.ToUpper()
} while ($userInput -ne "Y" -and $userInput -ne "N")
return ($userInput -eq "Y")
}
function Get-VBoxVersion {
param([string]$VBoxManager)
try {
$versionOutput = & $VBoxManager --version 2>&1
if ($versionOutput -match '(\d+)\.(\d+)\.(\d+)') {
return [PSCustomObject]@{
Major = [int]$matches[1]
Minor = [int]$matches[2]
Patch = [int]$matches[3]
FullVersion = $versionOutput
}
}
}
catch {
Write-Host " # [WARNING] Could not detect VirtualBox version. Assuming latest." -ForegroundColor Yellow
}
return [PSCustomObject]@{
Major = 7
Minor = 0
Patch = 0
FullVersion = "Unknown"
}
}
function Close-VirtualBoxProcesses {
Write-Host "Checking for running VirtualBox processes..."
$vboxSvc = Get-Process -Name "VBoxSVC" -ErrorAction SilentlyContinue
if ($vboxSvc) {
Write-Host "Stopping VBoxSVC.exe process..."
Stop-Process -Name "VBoxSVC" -Force
Write-Host "VBoxSVC.exe terminated."
}
$virtualBox = Get-Process -Name "VirtualBox" -ErrorAction SilentlyContinue
if ($virtualBox) {
Write-Host "Stopping VirtualBox.exe process..."
Stop-Process -Name "VirtualBox" -Force
Write-Host "VirtualBox.exe terminated."
}
$otherVBox = Get-Process | Where-Object { $_.Name -like "VBox*" -and $_.Name -ne "VBoxSVC" }
if ($otherVBox) {
Write-Host "Stopping other VirtualBox-related processes..."
$otherVBox | ForEach-Object {
Write-Host "Stopping $($_.Name)..."
Stop-Process -Id $_.Id -Force
}
}
Start-Sleep -Seconds 3
Write-Host "All VirtualBox processes have been terminated."
}
function Set-VMMouseFix {
param(
[Parameter(Mandatory=$true)]
[string]$VMName,
[string]$VBoxPath = "$env:USERPROFILE\VirtualBox VMs"
)
Write-Host "`n # ==================== PS/2 MOUSE FIX ===================" -ForegroundColor Magenta
Write-Host " # [INFO] Applying PS/2 Mouse fix for detection evasion..." -ForegroundColor Cyan
# Ensure processes are closed first
Close-VirtualBoxProcesses
$vboxFile = "$VBoxPath\$VMName\$VMName.vbox"
if (-not (Test-Path $vboxFile)) {
# Try standard path if custom path not found
$vboxFile = "$env:USERPROFILE\VirtualBox VMs\$VMName\$VMName.vbox"
if (-not (Test-Path $vboxFile)) {
Write-Host " # [WARNING] Could not find .vbox file at: $vboxFile" -ForegroundColor Yellow
return $false
}
}
Write-Host " # [OK] Found: $vboxFile" -ForegroundColor Green
# Create backup
$backupFile = "$vboxFile.backup_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
Copy-Item -Path $vboxFile -Destination $backupFile -Force
$content = Get-Content -Path $vboxFile -Raw
$newContent = $content
$modified = $false
# Case 1: Already fixed
if ($content -match '<HID Pointing="USBMouse" Keyboard="USBKeyboard"/>') {
Write-Host " # [OK] PS/2 Mouse fix is already applied." -ForegroundColor Green
return $true
}
# Case 2: Only Keyboard present
if ($content -match '<HID Keyboard="USBKeyboard"/>') {
Write-Host " # [INFO] Upgrading HID tag..." -ForegroundColor Gray
$newContent = $content -replace '<HID Keyboard="USBKeyboard"/>', '<HID Pointing="USBMouse" Keyboard="USBKeyboard"/>'
$modified = $true
}
# Case 3: Empty HID tag
elseif ($content -match '<HID[^/>]*/>') {
$match = [regex]::Match($content, '<HID[^/>]*/>')
Write-Host " # [INFO] Replacing generic HID tag..." -ForegroundColor Gray
$newContent = $content -replace '<HID[^/>]*/>', '<HID Pointing="USBMouse" Keyboard="USBKeyboard"/>'
$modified = $true
}
# Case 4: Missing HID tag completely (Common with PS/2 setting)
elseif ($content -notmatch '<HID') {
Write-Host " # [INFO] Inserting missing HID tag..." -ForegroundColor Yellow
if ($content -match '<Memory RAMSize="\d+"/>') {
$newLine = [System.Environment]::NewLine
$newContent = $content -replace '(<Memory RAMSize="\d+"/>)', "`$1$newLine <HID Pointing=`"USBMouse`" Keyboard=`"USBKeyboard`"/>"
$modified = $true
}
elseif ($content -match '<Hardware>') {
$newLine = [System.Environment]::NewLine
$newContent = $content -replace '(<Hardware>)', "`$1$newLine <HID Pointing=`"USBMouse`" Keyboard=`"USBKeyboard`"/>"
$modified = $true
}
}
if ($modified) {
try {
$utf8NoBom = New-Object System.Text.UTF8Encoding $false
[System.IO.File]::WriteAllText($vboxFile, $newContent, $utf8NoBom)
Write-Host " # [OK] Mouse fix applied successfully!" -ForegroundColor Green
return $true
}
catch {
Write-Host " # [ERROR] Failed to write file: $($_.Exception.Message)" -ForegroundColor Red
Copy-Item -Path $backupFile -Destination $vboxFile -Force
return $false
}
} else {
Write-Host " # [WARNING] Could not apply mouse fix automatically." -ForegroundColor Yellow
return $false
}
}
function Get-SystemInfo {
Write-Host "`n # [INFO] Detecting system hardware..." -ForegroundColor Yellow
function Get-SafeInt {
param($InputObject)
try {
if ($null -eq $InputObject) { return 0 }
if ($InputObject -is [array]) {
if ($InputObject.Count -eq 0) { return 0 }
return [int][math]::Round([double]$InputObject[0])
}
return [int][math]::Round([double]$InputObject)
} catch { return 0 }
}
$procInfo = $null
$memInfo = $null
$diskInfo = $null
$gpuInfo = $null
$finalCores = 4
$finalLogical = 8
$finalModel = "Unknown CPU"
$finalManu = "Unknown"
$finalRamGB = 8
$finalRamMB = 8192
$finalDiskGB = 256
$finalFreeGB = 128
$finalGpu = "Unknown GPU"
$detectionSuccess = $false
try {
$procInfo = @(Get-WmiObject -Class Win32_Processor -ErrorAction SilentlyContinue)
if ($procInfo) {
$coresSum = 0
$logicalSum = 0
foreach ($p in $procInfo) {
$coresSum += Get-SafeInt $p.NumberOfCores
$logicalSum += Get-SafeInt $p.NumberOfLogicalProcessors
}
if ($coresSum -gt 0) { $finalCores = $coresSum }
if ($logicalSum -gt 0) { $finalLogical = $logicalSum }
if ($procInfo[0].Name) { $finalModel = $procInfo[0].Name.Trim() }
if ($finalModel -match "Intel") { $finalManu = "Intel" } elseif ($finalModel -match "AMD") { $finalManu = "AMD" }
}
$memInfo = Get-WmiObject -Class Win32_ComputerSystem -ErrorAction SilentlyContinue | Select-Object -First 1
if ($memInfo) {
$bytes = [double]$memInfo.TotalPhysicalMemory
$finalRamGB = Get-SafeInt ($bytes / 1GB)
$finalRamMB = Get-SafeInt ($bytes / 1MB)
}
$sysDrive = $env:SystemDrive
$diskInfo = Get-WmiObject -Class Win32_LogicalDisk -Filter "DeviceID='$sysDrive'" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($diskInfo) {
$finalDiskGB = Get-SafeInt ($diskInfo.Size / 1GB)
$finalFreeGB = Get-SafeInt ($diskInfo.FreeSpace / 1GB)
}
$gpuInfo = @(Get-WmiObject -Class Win32_VideoController -ErrorAction SilentlyContinue)
if ($gpuInfo -and $gpuInfo.Count -gt 0) {
$finalGpu = $gpuInfo[0].Name
}
$detectionSuccess = $true
}
catch {
Write-Host " # [WARNING] Hardware detection failed. Using defaults." -ForegroundColor Yellow
$detectionSuccess = $false
}
return @{
CPUCores = $finalCores
CPULogicalProcessors = $finalLogical
CPUModel = [string]$finalModel
CPUManufacturer = [string]$finalManu
TotalRAM_GB = $finalRamGB
TotalRAM_MB = $finalRamMB
SystemDrive = $env:SystemDrive
TotalStorage_GB = $finalDiskGB
FreeStorage_GB = $finalFreeGB
GPUName = [string]$finalGpu
DetectionSuccessful = $detectionSuccess
}
}
function Get-RecommendedVMSettings {
param (
[Parameter(Mandatory=$true)]
[hashtable]$SystemInfo
)
if (-not $SystemInfo.DetectionSuccessful) {
Write-Host "`n # [WARNING] Could not auto-detect hardware. Please enter manually." -ForegroundColor Yellow
$SystemInfo.CPUCores = [int](Read-Host " # CPU Cores (e.g. 4, 8):")
$ramInput = [int](Read-Host " # RAM in GB (e.g. 16, 32):")
$SystemInfo.TotalRAM_GB = $ramInput
$SystemInfo.TotalRAM_MB = $ramInput * 1024
$SystemInfo.FreeStorage_GB = [int](Read-Host " # Free Storage in GB (e.g. 100):")
$SystemInfo.CPUManufacturer = Read-Host " # CPU Type (Intel/AMD):"
}
[int]$cores = $SystemInfo.CPUCores
[int]$ramMB = $SystemInfo.TotalRAM_MB
[int]$freeDisk = $SystemInfo.FreeStorage_GB
$recCores = 2
if ($cores -ge 16) { $recCores = 8 }
elseif ($cores -ge 10) { $recCores = 6 }
elseif ($cores -ge 8) { $recCores = 4 }
elseif ($cores -ge 6) { $recCores = 3 }
elseif ($cores -eq 1) { $recCores = 1 }
else { $recCores = [math]::Floor($cores / 2) }
if ($recCores -lt 1) { $recCores = 1 }
[int]$recRAM = 4096
if ($SystemInfo.TotalRAM_GB -lt 8) { $recRAM = 2048 }
elseif ($SystemInfo.TotalRAM_GB -lt 16) { $recRAM = 4096 }
elseif ($SystemInfo.TotalRAM_GB -lt 32) { $recRAM = 8192 }
else { $recRAM = 16384 }
$maxSafeRAM = $ramMB - 2048
if ($maxSafeRAM -lt 1024) { $maxSafeRAM = 1024 }
if ($recRAM -gt $maxSafeRAM) { $recRAM = $maxSafeRAM }
[int]$recDisk = 60
if ($freeDisk -lt 120) { $recDisk = 40 }
if ($freeDisk -lt 60) { $recDisk = 25 }
if ("$($SystemInfo.CPUManufacturer)" -eq "Intel") {
$prof = "Intel Core i7-6700K"
$choice = "1"
} else {
$prof = "AMD Ryzen 7 1800X"
$choice = "5"
}
return @{
CPUCores = [int]$recCores
RAM_MB = [int]$recRAM
Storage_GB = [int]$recDisk
CPUProfile = [string]$prof
CPUChoice = [string]$choice
}
}
function Remove-VirtualMachine {
param(
[string]$VBoxManager
)
Write-Host "`n # ==================== DELETE VIRTUAL MACHINE ===================" -ForegroundColor Magenta
Write-Host "`n # Available VMs on this system:`n" -ForegroundColor Cyan
& $VBoxManager list vms
$vmToDelete = Read-Host "`n # Enter the VM Name to DELETE"
if ([string]::IsNullOrWhiteSpace($vmToDelete)) {
Write-Host " # [ERROR] No VM name entered. Aborting." -ForegroundColor Red
return
}
$vmInfo = & $VBoxManager showvminfo $vmToDelete 2>&1
if ($vmInfo -like "*VBOX_E_OBJECT_NOT_FOUND*") {
Write-Host " # [ERROR] VM '$vmToDelete' does not exist!" -ForegroundColor Red
return
}
Write-Host "`n # [WARNING] You are about to DELETE VM: $vmToDelete" -ForegroundColor Yellow
Write-Host " # This action cannot be undone!" -ForegroundColor Red
$confirmDelete = Get-YesNoChoice "Are you absolutely sure you want to delete this VM?" "N" "Type Y to confirm deletion"
if (-not $confirmDelete) {
Write-Host " # [INFO] Deletion cancelled." -ForegroundColor Cyan
return
}
Write-Host "`n # Deletion Options:" -ForegroundColor Cyan
Write-Host " # 1. Delete VM registration only (keep all files)" -ForegroundColor Gray
Write-Host " # 2. Delete VM and all associated files (complete removal)" -ForegroundColor Gray
$deleteChoice = Get-UserChoice "Select deletion option (1-2):" "1" "Option 2 permanently deletes all VM files"
try {
if ($deleteChoice -eq "2") {
Write-Host "`n # [INFO] Deleting VM '$vmToDelete' and ALL associated files..." -ForegroundColor Yellow
& $VBoxManager unregistervm $vmToDelete --delete
if ($LASTEXITCODE -eq 0) {
Write-Host " # [OK] VM '$vmToDelete' and all files have been permanently deleted." -ForegroundColor Green
} else {
Write-Host " # [ERROR] Failed to delete VM (Exit code: $LASTEXITCODE)." -ForegroundColor Red
}
} else {
Write-Host "`n # [INFO] Removing VM registration for '$vmToDelete' (keeping files)..." -ForegroundColor Yellow
& $VBoxManager unregistervm $vmToDelete
if ($LASTEXITCODE -eq 0) {
Write-Host " # [OK] VM '$vmToDelete' has been unregistered. Files are preserved." -ForegroundColor Green
Write-Host " # [INFO] VM files location: $env:USERPROFILE\VirtualBox VMs\$vmToDelete" -ForegroundColor Cyan
} else {
Write-Host " # [ERROR] Failed to unregister VM (Exit code: $LASTEXITCODE)." -ForegroundColor Red
}
}
}
catch {
Write-Host " # [ERROR] An error occurred during deletion: $_" -ForegroundColor Red
}
Write-Host "`n # Press any key to continue..." -ForegroundColor Magenta
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
# ================= MAIN SCRIPT START =================
Close-VirtualBoxProcesses
Write-Host "`n ###################################################" -ForegroundColor Magenta
Write-Host " # #" -ForegroundColor Magenta
Write-Host " # BYPASS PROCTORING WITH CLOAKBOX #" -ForegroundColor Magenta
Write-Host " # #" -ForegroundColor Magenta
Write-Host " ###################################################" -ForegroundColor Magenta
Write-Host "`n # This tool will help you configure your Cloakbox VM to avoid detection." -ForegroundColor Cyan
Write-Host " # Default values are shown in [brackets]." -ForegroundColor Cyan
$systemInfo = Get-SystemInfo
$recommendedSettings = Get-RecommendedVMSettings -SystemInfo $systemInfo
if ($systemInfo.DetectionSuccessful) {
Write-Host "`n # ==================== SYSTEM DETECTED =====================" -ForegroundColor Magenta
Write-Host " # CPU: $($systemInfo.CPUModel) ($($systemInfo.CPUCores) cores, $($systemInfo.CPULogicalProcessors) threads)" -ForegroundColor Gray
Write-Host " # RAM: $($systemInfo.TotalRAM_GB) GB ($($systemInfo.TotalRAM_MB) MB)" -ForegroundColor Gray
Write-Host " # Storage: $($systemInfo.FreeStorage_GB) GB free of $($systemInfo.TotalStorage_GB) GB total" -ForegroundColor Gray
Write-Host " # GPU: $($systemInfo.GPUName)" -ForegroundColor Gray
Write-Host " # ==========================================================" -ForegroundColor Magenta
} else {
Write-Host "`n # ==================== SYSTEM INFO (MANUAL) ================" -ForegroundColor Magenta
Write-Host " # CPU: $($systemInfo.CPUManufacturer) ($($systemInfo.CPUCores) cores)" -ForegroundColor Gray
Write-Host " # RAM: $($systemInfo.TotalRAM_GB) GB" -ForegroundColor Gray
Write-Host " # Storage: $($systemInfo.FreeStorage_GB) GB free" -ForegroundColor Gray
Write-Host " # ==========================================================" -ForegroundColor Magenta
}
Write-Host "`n # ================ RECOMMENDED VM SETTINGS ================" -ForegroundColor Magenta
Write-Host " # CPU Cores: $($recommendedSettings.CPUCores) cores (VM will use ~50% of your CPU)" -ForegroundColor Gray
Write-Host " # RAM: $([math]::Round($recommendedSettings.RAM_MB/1024, 1)) GB = $($recommendedSettings.RAM_MB) MB (VM will use ~50% of your RAM)" -ForegroundColor Gray
Write-Host " # Storage: $($recommendedSettings.Storage_GB) GB (Leaves space for host OS)" -ForegroundColor Gray
Write-Host " # CPU Profile: $($recommendedSettings.CPUProfile)" -ForegroundColor Gray
Write-Host " # ==========================================================" -ForegroundColor Magenta
Write-Host "`n # [TIP] These defaults allocate ~50% of your resources to the VM." -ForegroundColor Yellow
Write-Host " # You can customize these in the next steps." -ForegroundColor Yellow
$defaultVBoxPath = "$env:ProgramFiles\Vektor T13\VirtualBox"
$vboxPathExists = Test-Path "$defaultVBoxPath\VBoxManage.exe"
if ($vboxPathExists) {
Write-Host "`n # [INFO] Cloakbox installation found at default location." -ForegroundColor Green
$VBoxPath = $defaultVBoxPath
} else {
$VBoxPath = Get-UserChoice "Enter the path to your Cloakbox/VirtualBox installation:" $defaultVBoxPath "e.g. C:\Program Files\Vektor T13\VirtualBox"
if (-not (Test-Path "$VBoxPath\VBoxManage.exe")) {
Write-Host " # [ERROR] VBoxManage.exe not found at '$VBoxPath\VBoxManage.exe'." -ForegroundColor Red
Write-Host " # Please verify your Cloakbox/VirtualBox installation path and try again." -ForegroundColor Red
pause
exit 1
}
}
$VBoxManager = "$VBoxPath\VBoxManage.exe"
$vboxVersion = Get-VBoxVersion -VBoxManager $VBoxManager
Write-Host "`n # [INFO] Detected VirtualBox version: $($vboxVersion.FullVersion)" -ForegroundColor Cyan
Write-Host "`n # ==================== MAIN MENU ===================" -ForegroundColor Magenta
Write-Host " # 1. Create or Modify a VM" -ForegroundColor Gray
Write-Host " # 2. Delete a VM" -ForegroundColor Gray
Write-Host " # 3. Exit" -ForegroundColor Gray
$menuChoice = Get-UserChoice "Select an option (1-3):" "1" "Choose what you want to do"
if ($menuChoice -eq "2") {
Remove-VirtualMachine -VBoxManager $VBoxManager
Write-Host "`n # Script complete. Press any key to exit..." -ForegroundColor Magenta
pause
exit 0
} elseif ($menuChoice -eq "3") {
Write-Host "`n # Exiting script..." -ForegroundColor Cyan
exit 0
}
try {
Write-Host "`n # Available VMs on this system (May take a few seconds):`n" -ForegroundColor Cyan
& $VBoxManager list vms
Write-Host "`n # [TIP] Type a NEW name to create a VM, or an EXISTING name to modify it." -ForegroundColor Yellow
$VM = Read-Host "`n # Enter the VM Name"
if ([string]::IsNullOrWhiteSpace($VM)) {
Write-Host "`n # [ERROR] No VM name entered. Aborting script." -ForegroundColor Red
pause
exit 1
}
$vmExists = & $VBoxManager showvminfo $VM 2>&1
$createNewVM = $vmExists -like "*VBOX_E_OBJECT_NOT_FOUND*"
if ($createNewVM) {
Write-Host "`n # [INFO] VM '$VM' does not exist. Will create new VM." -ForegroundColor Cyan
} else {
Write-Host "`n # [INFO] VM '$VM' already exists. Will modify existing VM." -ForegroundColor Cyan
}
Write-Host "`n # ==================== UNATTENDED INSTALLATION ===================" -ForegroundColor Magenta
$useUnattended = $false
$isoPath = ""
$windowsEdition = ""
$windowsVersion = ""
$windowsUsername = ""
$windowsPasswordPlain = ""
$windowsFullName = ""
$windowsHostname = "$VM.local"
$windowsDomain = ""
$productKey = ""
$installGuestAdditions = $false
$guestAdditionsIsoPath = ""
$installInBackground = $false
if ($createNewVM) {
Write-Host "`n # [INFO] Unattended installation automates Windows setup (no manual clicking)." -ForegroundColor Cyan
Write-Host " # [WARNING] If it fails, just install Windows manually instead." -ForegroundColor Yellow
$useUnattended = Get-YesNoChoice "Configure unattended (automatic) Windows installation?" "Y" "Automatically install Windows without manual intervention"
} else {
Write-Host " # [INFO] Skipping unattended install for existing VM." -ForegroundColor Gray
}
if ($useUnattended) {
Write-Host "`n # ========== STEP 1: SELECT WINDOWS ISO ==========" -ForegroundColor Magenta
Write-Host "`n # [INFO] Select Windows ISO file..." -ForegroundColor Yellow
Add-Type -AssemblyName System.Windows.Forms
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$openFileDialog.Filter = "ISO files (*.iso)|*.iso|All files (*.*)|*.*"
$openFileDialog.Title = "Select Windows Installation ISO"
$openFileDialog.InitialDirectory = [Environment]::GetFolderPath("MyDocuments")
if ($openFileDialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$isoPath = $openFileDialog.FileName
Write-Host " # [OK] Selected ISO: $isoPath" -ForegroundColor Green
} else {
Write-Host " # [WARNING] No ISO selected. Unattended install will be skipped." -ForegroundColor Yellow
$useUnattended = $false
}
if ($useUnattended) {
Write-Host "`n # ========== STEP 2: WINDOWS EDITION ==========" -ForegroundColor Magenta
$isoFileName = [System.IO.Path]::GetFileNameWithoutExtension($isoPath)
Write-Host "`n # [INFO] Analyzing ISO: $isoFileName" -ForegroundColor Cyan
$detectedEditions = @()
$autoDetected = $false
if ($isoFileName -match "Win11|Windows11|W11") {
Write-Host " # [DETECTED] Windows 11 ISO" -ForegroundColor Green
$detectedEditions = @{
"1" = @{Name = "Windows 11 Pro"; EditionId = "Windows 11 Pro"; Type = "Microsoft Windows"; Version = "Windows 11 (64-bit)"}
"2" = @{Name = "Windows 11 Home"; EditionId = "Windows 11 Home"; Type = "Microsoft Windows"; Version = "Windows 11 (64-bit)"}
}
$autoDetected = $true
}
elseif ($isoFileName -match "Win10|Windows10|W10") {
Write-Host " # [DETECTED] Windows 10 ISO" -ForegroundColor Green
$detectedEditions = @{
"1" = @{Name = "Windows 10 Pro"; EditionId = "Windows 10 Pro"; Type = "Microsoft Windows"; Version = "Windows 10 (64-bit)"}
"2" = @{Name = "Windows 10 Home"; EditionId = "Windows 10 Home"; Type = "Microsoft Windows"; Version = "Windows 10 (64-bit)"}
}
$autoDetected = $true
}
else {
Write-Host " # [WARNING] Could not auto-detect Windows version from filename" -ForegroundColor Yellow
Write-Host " # [INFO] Please select manually" -ForegroundColor Cyan
$detectedEditions = @{
"1" = @{Name = "Windows 11 Pro"; EditionId = "Windows 11 Pro"; Type = "Microsoft Windows"; Version = "Windows 11 (64-bit)"}
"2" = @{Name = "Windows 11 Home"; EditionId = "Windows 11 Home"; Type = "Microsoft Windows"; Version = "Windows 11 (64-bit)"}
"3" = @{Name = "Windows 10 Pro"; EditionId = "Windows 10 Pro"; Type = "Microsoft Windows"; Version = "Windows 10 (64-bit)"}
"4" = @{Name = "Windows 10 Home"; EditionId = "Windows 10 Home"; Type = "Microsoft Windows"; Version = "Windows 10 (64-bit)"}
}
$autoDetected = $false
}
Write-Host "`n # Available Windows Editions:" -ForegroundColor Cyan
foreach ($key in $detectedEditions.Keys | Sort-Object) {
Write-Host " # $key. $($detectedEditions[$key].Name)" -ForegroundColor Gray
}
if ($autoDetected) {
$editionChoice = Get-UserChoice "Select Windows Edition (1-2):" "1" "Pro recommended (has more features)"
} else {
$editionChoice = Get-UserChoice "Select Windows Edition (1-4):" "1" "Must match your ISO"
}
$selectedEdition = $detectedEditions[$editionChoice]
$windowsEdition = $selectedEdition.EditionId
$windowsType = $selectedEdition.Type
$windowsVersion = $selectedEdition.Version
Write-Host " # [OK] Selected: $windowsEdition" -ForegroundColor Green
Write-Host "`n # ========== STEP 3: USERNAME AND PASSWORD ==========" -ForegroundColor Magenta
$defaultUsername = "User"
$windowsUsername = Get-UserChoice "Enter Windows username:" $defaultUsername "This will be your Windows account name"
Write-Host "`n # Enter Windows password:" -NoNewline -ForegroundColor Cyan
Write-Host " (typing is hidden)" -ForegroundColor Gray
Write-Host " # [TIP] VirtualBox unattended install requires a password." -ForegroundColor Yellow
Write-Host " # [TIP] Use a simple temporary password, you can change it after installation." -ForegroundColor Yellow
Write-Host " # [TIP] Suggested: ChangeMe123!" -ForegroundColor Yellow
$windowsPassword = Read-Host -AsSecureString
$windowsPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($windowsPassword)
)
if ([string]::IsNullOrWhiteSpace($windowsPasswordPlain)) {
Write-Host " # [WARNING] No password entered!" -ForegroundColor Yellow
Write-Host " # [INFO] A temporary password 'ChangeMe123!' will be used." -ForegroundColor Cyan
Write-Host " # [INFO] You can change it after Windows installs." -ForegroundColor Cyan
$confirmNoPassword = Get-YesNoChoice "Continue with temporary password?" "Y" "You can change it later"
if (-not $confirmNoPassword) {
Write-Host " # [INFO] Please enter a password:" -NoNewline -ForegroundColor Cyan
$windowsPassword = Read-Host -AsSecureString
$windowsPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($windowsPassword)
)
}
}
Write-Host " # [OK] Username: $windowsUsername" -ForegroundColor Green
if ([string]::IsNullOrWhiteSpace($windowsPasswordPlain)) {
Write-Host " # [OK] Password: (none)" -ForegroundColor Yellow
} else {
Write-Host " # [OK] Password: ********" -ForegroundColor Green
}
Write-Host "`n # ========== STEP 4: PRODUCT KEY (OPTIONAL) ==========" -ForegroundColor Magenta
$useProductKey = Get-YesNoChoice "Do you have a Windows product key?" "N" "Skip to activate later"
if ($useProductKey) {
$productKey = Read-Host " # Enter Windows product key (format: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX)"
if ([string]::IsNullOrWhiteSpace($productKey)) {
Write-Host " # [INFO] No product key entered - Windows will run unactivated." -ForegroundColor Yellow
$productKey = ""
} else {
Write-Host " # [OK] Product key: $productKey" -ForegroundColor Green
}
} else {
$productKey = ""
Write-Host " # [INFO] Skipping product key - Windows will run unactivated." -ForegroundColor Cyan
}
Write-Host "`n # ========== STEP 5: HOSTNAME ==========" -ForegroundColor Magenta
$defaultHostname = "$VM"
$windowsHostname = Get-UserChoice "Enter computer hostname:" $defaultHostname "Computer name shown in Windows"
# VirtualBox requires .local suffix
if ($windowsHostname -notmatch '\.') {
$windowsHostname = "$windowsHostname.local"
Write-Host " # [INFO] Added .local suffix: $windowsHostname" -ForegroundColor Cyan
}
Write-Host " # [OK] Hostname: $windowsHostname" -ForegroundColor Green
Write-Host "`n # ========== STEP 6: DOMAIN (OPTIONAL) ==========" -ForegroundColor Magenta
$useDomain = Get-YesNoChoice "Join a Windows domain?" "N" "Most users should skip this"
if ($useDomain) {
$windowsDomain = Read-Host " # Enter domain name (e.g. company.local)"
if ([string]::IsNullOrWhiteSpace($windowsDomain)) {
Write-Host " # [INFO] No domain entered - will use WORKGROUP." -ForegroundColor Cyan
$windowsDomain = ""
} else {
Write-Host " # [OK] Domain: $windowsDomain" -ForegroundColor Green
}
} else {
$windowsDomain = ""
Write-Host " # [INFO] Skipping domain - will use WORKGROUP." -ForegroundColor Cyan
}
Write-Host "`n # ========== STEP 6.5: LOCALE AND TIMEZONE ==========" -ForegroundColor Magenta
$timeZones = @{
"1" = "UTC"
"2" = "America/New_York (EST/EDT)"
"3" = "America/Chicago (CST/CDT)"
"4" = "America/Los_Angeles (PST/PDT)"
"5" = "Europe/London (GMT/BST)"
"6" = "Europe/Paris (CET/CEST)"
}
Write-Host "`n # Available Time Zones:" -ForegroundColor Cyan
foreach ($key in $timeZones.Keys | Sort-Object) {
Write-Host " # $key. $($timeZones[$key])" -ForegroundColor Gray
}
$tzChoice = Get-UserChoice "Select time zone (1-6):" "1" "UTC is most compatible"
$selectedTZ = switch ($tzChoice) {
"2" { "EST" }
"3" { "CST" }
"4" { "PST" }
"5" { "GMT" }
"6" { "CET" }
default { "UTC" }
}
Write-Host " # [OK] Time zone: $selectedTZ" -ForegroundColor Green
Write-Host "`n # ========== STEP 7: INSTALL IN BACKGROUND ==========" -ForegroundColor Magenta
Write-Host " # [INFO] Background install runs the VM headless (no window)." -ForegroundColor Cyan
Write-Host " # [INFO] You won't see the installation progress." -ForegroundColor Cyan
$installInBackground = Get-YesNoChoice "Install in background?" "N" "Recommended: N (so you can see progress)"
if ($installInBackground) {
Write-Host " # [OK] VM will start headless during installation." -ForegroundColor Green
} else {
Write-Host " # [OK] VM window will show during installation." -ForegroundColor Green
}
Write-Host "`n # ========== STEP 8: GUEST ADDITIONS ==========" -ForegroundColor Magenta
Write-Host " # [WARNING] Guest Additions increases VM detection!" -ForegroundColor Yellow
Write-Host " # Proctoring software can easily detect:" -ForegroundColor Yellow
Write-Host " # - VBoxGuest.sys driver" -ForegroundColor Red
Write-Host " # - VBoxService.exe process" -ForegroundColor Red
Write-Host " # - VirtualBox registry keys" -ForegroundColor Red
$installGuestAdditions = Get-YesNoChoice "Install VirtualBox Guest Additions automatically?" "N" "NOT recommended for anti-detection"
if ($installGuestAdditions) {
Write-Host "`n # [WARNING] You chose to install Guest Additions - VM will be DETECTABLE!" -ForegroundColor Red
$defaultGAPath = "C:\Program Files\Vektor T13\VirtualBox\DriverUpdaterCD.iso"
if (Test-Path $defaultGAPath) {
$guestAdditionsIsoPath = $defaultGAPath
Write-Host " # [OK] Found Guest Additions ISO: $guestAdditionsIsoPath" -ForegroundColor Green
} else {
Write-Host "`n # [INFO] Select Guest Additions ISO file..." -ForegroundColor Yellow
$openFileDialog2 = New-Object System.Windows.Forms.OpenFileDialog
$openFileDialog2.Filter = "ISO files (*.iso)|*.iso|All files (*.*)|*.*"
$openFileDialog2.Title = "Select DriverUpdaterCD.iso"
$openFileDialog2.InitialDirectory = "C:\Program Files\Vektor T13\VirtualBox\"
if ($openFileDialog2.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$guestAdditionsIsoPath = $openFileDialog2.FileName
Write-Host " # [OK] Selected Guest Additions ISO: $guestAdditionsIsoPath" -ForegroundColor Green
} else {
Write-Host " # [WARNING] No Guest Additions ISO selected. Will skip installation." -ForegroundColor Yellow
$installGuestAdditions = $false
}
}
} else {
Write-Host " # [OK] Guest Additions will NOT be installed (good for anti-detection)." -ForegroundColor Green
}
$windowsFullName = $windowsUsername
Write-Host "`n # ========== UNATTENDED INSTALL SUMMARY ==========" -ForegroundColor Magenta
Write-Host " # ISO: $isoPath" -ForegroundColor Gray
Write-Host " # Edition: $windowsEdition" -ForegroundColor Gray
Write-Host " # Username: $windowsUsername" -ForegroundColor Gray
Write-Host " # Password: $(if ([string]::IsNullOrWhiteSpace($windowsPasswordPlain)) { '(none)' } else { '********' })" -ForegroundColor Gray
Write-Host " # Product Key: $(if ([string]::IsNullOrWhiteSpace($productKey)) { '(none - unactivated)' } else { $productKey })" -ForegroundColor Gray
Write-Host " # Hostname: $windowsHostname" -ForegroundColor Gray
Write-Host " # Domain: $(if ([string]::IsNullOrWhiteSpace($windowsDomain)) { '(none - WORKGROUP)' } else { $windowsDomain })" -ForegroundColor Gray
Write-Host " # Background Install: $(if ($installInBackground) { 'Yes' } else { 'No' })" -ForegroundColor Gray
Write-Host " # Guest Additions: $(if ($installGuestAdditions) { 'Yes (DETECTABLE!)' } else { 'No (stealthy)' })" -ForegroundColor Gray
Write-Host " # ================================================" -ForegroundColor Magenta
$confirmUnattended = Get-YesNoChoice "Proceed with these settings?" "Y" "Confirm unattended install configuration"
if (-not $confirmUnattended) {
Write-Host " # [INFO] Unattended install cancelled by user." -ForegroundColor Yellow
$useUnattended = $false
} else {
Write-Host " # [OK] Unattended installation configured." -ForegroundColor Green
}
}
}
Write-Host "`n # ==================== OPERATING SYSTEM ====================" -ForegroundColor Magenta
$osOptions = @{
"1" = @{Type = "Windows11_64"; Name = "Windows 11 (64-bit)"}
"2" = @{Type = "Windows10_64"; Name = "Windows 10 (64-bit)"}
}
if ($useUnattended -and $windowsVersion) {
Write-Host "`n # [INFO] Using OS type from unattended install configuration" -ForegroundColor Cyan
if ($windowsVersion -like "*Windows 11*") {
$osType = "Windows11_64"
Write-Host " # [OK] OS Type: Windows 11 (64-bit)" -ForegroundColor Green
} else {
$osType = "Windows10_64"
Write-Host " # [OK] OS Type: Windows 10 (64-bit)" -ForegroundColor Green
}
} else {
Write-Host "`n # Available Operating Systems:" -ForegroundColor Cyan
foreach ($key in $osOptions.Keys | Sort-Object) {
Write-Host " # $key. $($osOptions[$key].Name)" -ForegroundColor Gray
}
$osChoice = Get-UserChoice "Select Operating System (1-2):" "2" "Windows 10 has better compatibility"
$selectedOS = $osOptions[$osChoice]
$osType = $selectedOS.Type
Write-Host " # [OK] Selected: $($selectedOS.Name)" -ForegroundColor Green
}
Write-Host "`n # ==================== HARDWARE ===================" -ForegroundColor Magenta
$minRAM = 1024
if ($systemInfo.TotalRAM_MB -gt 0) {
$maxRAM = $systemInfo.TotalRAM_MB - 2048
if ($maxRAM -lt $minRAM) { $maxRAM = $systemInfo.TotalRAM_MB }
} else {
$maxRAM = 16384
}
if ($null -ne $recommendedSettings.RAM_MB -and $recommendedSettings.RAM_MB -gt 0) {
$defaultMemory = $recommendedSettings.RAM_MB.ToString()
} else {
$defaultMemory = "4096"
}
Write-Host "`n # Base Memory Range: $minRAM MB (1 GB) to $maxRAM MB ($([math]::Round($maxRAM/1024, 1)) GB)" -ForegroundColor Gray
$memory = Get-UserChoice "Enter memory size in MB:" $defaultMemory "Recommended: $defaultMemory MB = $([math]::Round([int]$defaultMemory/1024, 1)) GB"
$minCPU = 1
$maxCPU = $systemInfo.CPUCores
$defaultCPUs = $recommendedSettings.CPUCores.ToString()
Write-Host "`n # Processors Range: $minCPU to $maxCPU cores available" -ForegroundColor Gray
$cpus = Get-UserChoice "Enter number of CPU cores:" $defaultCPUs "Recommended: $defaultCPUs cores (~50% of your system)"
$cpuProfiles = @{
"1" = @{
Name = "Intel Core i7-6700K"
VBoxProfile = "Intel Core i7-6700K"
Manufacturer = "Intel"
Socket = "LGA1151"
CPUID_EAX = "000506E3"
CPUID_EBX = "00100800"
CPUID_ECX = "7FFAFBFF"
CPUID_EDX = "BFEBFBFF"
CPUID_0_EAX = "00000016"
Brand_80000002 = @("65746E49", "2952286C", "726F4320", "4D542865")
Brand_80000003 = @("37692029", "3030372D", "5043204B", "40205055")
Brand_80000004 = @("30302E34", "007A4847", "00000000", "00000000")
DMIName = "Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz"
DMIFamily = "0xCD"
}
"2" = @{
Name = "Intel Core i7-9700K"
VBoxProfile = "Intel Core i7-9700K"
Manufacturer = "Intel"
Socket = "LGA1151"
CPUID_EAX = "000906ED"
CPUID_EBX = "00100800"
CPUID_ECX = "7FFAFBFF"
CPUID_EDX = "BFEBFBFF"
CPUID_0_EAX = "00000016"
Brand_80000002 = @("65746E49", "2952286C", "726F4320", "4D542865")
Brand_80000003 = @("37692029", "3030372D", "5043204B", "40205055")
Brand_80000004 = @("30362E33", "007A4847", "00000000", "00000000")
DMIName = "Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz"
DMIFamily = "0xCD"
}
"3" = @{
Name = "Intel Core i7-3960X"
VBoxProfile = "Intel Core i7-3960X"
Manufacturer = "Intel"
Socket = "LGA2011"
CPUID_EAX = "000206D7"
CPUID_EBX = "00100800"
CPUID_ECX = "1FBAE3FF"
CPUID_EDX = "BFEBFBFF"
CPUID_0_EAX = "0000000D"
Brand_80000002 = @("65746E49", "2952286C", "726F4320", "4D542865")
Brand_80000003 = @("37692029", "3036392D", "43205858", "40205550")
Brand_80000004 = @("30332E33", "007A4847", "00000000", "00000000")
DMIName = "Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz"
DMIFamily = "0xCD"
}
"4" = @{
Name = "Intel Core i9-9900K"
VBoxProfile = "Intel Core i9-9900K"
Manufacturer = "Intel"
Socket = "LGA1151"
CPUID_EAX = "000906ED"
CPUID_EBX = "00100800"
CPUID_ECX = "7FFAFBFF"
CPUID_EDX = "BFEBFBFF"
CPUID_0_EAX = "00000016"
Brand_80000002 = @("65746E49", "2952286C", "726F4320", "4D542865")
Brand_80000003 = @("39692029", "3030392D", "5043204B", "40205055")
Brand_80000004 = @("30362E33", "007A4847", "00000000", "00000000")
DMIName = "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz"
DMIFamily = "0xCD"
}
"5" = @{
Name = "AMD Ryzen 7 1800X"
VBoxProfile = "AMD Ryzen 7 1800X Eight-Core"
Manufacturer = "AMD"
Socket = "AM4"
CPUID_EAX = "00800F11"
CPUID_EBX = "00100800"
CPUID_ECX = "7ED8320B"
CPUID_EDX = "178BFBFF"
CPUID_0_EAX = "0000000D"
Brand_80000002 = @("20444D41", "657A7952", "2037206E", "30303831")
Brand_80000003 = @("69452058", "2D746867", "65726F43", "6F725020")
Brand_80000004 = @("73736563", "0000726F", "00000000", "00000000")
DMIName = "AMD Ryzen 7 1800X Eight-Core Processor"
DMIFamily = "0x6B"
}
"6" = @{
Name = "Intel Core i7-7700K"
VBoxProfile = "Intel Core i7-7700K"
Manufacturer = "Intel"
Socket = "LGA1151"
CPUID_EAX = "000906E9"
CPUID_EBX = "00100800"
CPUID_ECX = "7FFAFBFF"
CPUID_EDX = "BFEBFBFF"
CPUID_0_EAX = "00000016"
Brand_80000002 = @("65746E49", "2952286C", "726F4320", "4D542865")
Brand_80000003 = @("37692029", "3030372D", "5043204B", "40205055")
Brand_80000004 = @("30322E34", "007A4847", "00000000", "00000000")
DMIName = "Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz"
DMIFamily = "0xCD"
}
}
Write-Host "`n # Available CPU models:" -ForegroundColor Cyan
Write-Host " # [INFO] Will try VirtualBox built-in profiles first, fallback to manual CPUID if needed" -ForegroundColor Gray
Write-Host ""
foreach ($key in $cpuProfiles.Keys | Sort-Object) {
if ($key -eq $recommendedSettings.CPUChoice) {
Write-Host " # $key. $($cpuProfiles[$key].Name) (RECOMMENDED)" -ForegroundColor Green
} else {
Write-Host " # $key. $($cpuProfiles[$key].Name)" -ForegroundColor Gray
}
}
$cpuChoice = Get-UserChoice "Select a CPU model (1-6):" $recommendedSettings.CPUChoice "Recommended based on your CPU type"
$cpuProfile = $cpuProfiles[$cpuChoice]
if ($null -eq $cpuProfile) {
$cpuProfile = $cpuProfiles[$recommendedSettings.CPUChoice]