GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Windows-PowerShell-Scripts/Prep_Windows_For_Linux.ps1 at main · Ryan-Adams57/Windows-PowerShell-Scripts

Expand file tree

/

Prep_Windows_For_Linux.ps1

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
73 lines (61 loc) · 2.57 KB
/

Prep_Windows_For_Linux.ps1

Copy path

File metadata and controls

73 lines (61 loc) · 2.57 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<#
.SYNOPSIS
Prepare Windows PC for BIOS AHCI/Secure Boot changes before installing Linux.
.DESCRIPTION
This script automates the Windows-side configuration required to safely enable AHCI
drivers and boot into Safe Mode, minimizing boot failures when changing BIOS settings.
It does NOT modify BIOS directly. Manual BIOS steps are still required.
.PREREQUISITES
- Run as Administrator in PowerShell.
- Save any open work before running (computer will restart).
- After script-triggered Safe Mode boot, manually enable AHCI and disable Secure Boot in BIOS.
#>
# ==============================
# Step 1: Enable Safe Mode on Next Boot
# ==============================
Write-Host "Configuring Windows to boot in Safe Mode on next restart..." -ForegroundColor Yellow
bcdedit /set {current} safeboot minimal
# ==============================
# Step 2: Enable AHCI Drivers
# ==============================
Write-Host "Setting AHCI driver registry keys..." -ForegroundColor Yellow
# Intel AHCI (iaStorV) driver
$iaStorVPath = "HKLM:\SYSTEM\CurrentControlSet\Services\iaStorV"
if (Test-Path $iaStorVPath) {
Set-ItemProperty -Path $iaStorVPath -Name "Start" -Value 0
Write-Host "iaStorV driver configured." -ForegroundColor Green
} else {
Write-Host "iaStorV driver not found. Skipping..." -ForegroundColor Cyan
}
# Standard AHCI (storahci) driver
$storahciPath = "HKLM:\SYSTEM\CurrentControlSet\Services\storahci"
if (Test-Path $storahciPath) {
Set-ItemProperty -Path $storahciPath -Name "Start" -Value 0
Write-Host "storahci driver configured." -ForegroundColor Green
} else {
Write-Host "storahci driver not found. Skipping..." -ForegroundColor Cyan
}
# ==============================
# Step 3: Restart Computer Immediately
# ==============================
Write-Host "Restarting computer to apply Safe Mode settings..." -ForegroundColor Yellow
Restart-Computer
# ==============================
# Manual Steps Required After Restart
# ==============================
<#
1️⃣ Enter BIOS/UEFI (commonly F2, F12, Del, or Esc during boot).
2️⃣ Navigate to Storage/SATA settings and change mode to AHCI.
3️⃣ Locate Secure Boot in Security/Boot menu and set to Disabled.
4️⃣ Save BIOS changes and exit.
Once Windows boots into Safe Mode:
# ==============================
# Step 4: Exit Safe Mode
# ==============================
Run the following PowerShell command as Administrator:
bcdedit /deletevalue {current} safeboot
# ==============================
# Step 5: Final Restart
# ==============================
Restart the computer one final time to boot normally with AHCI enabled.
#>
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.