This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # expand-disk.ps1 | |
| # Automatically expands drive C: once after first boot, then deletes itself. | |
| $taskName = "ExpandC" | |
| $scriptPath = $MyInvocation.MyCommand.Path | |
| function Write-Info($msg){ Write-Host "[INFO] $msg" } | |
| function Write-Ok($msg){ Write-Host "[OK] $msg" } | |
| function Write-Warn($msg){ Write-Host "[WARN] $msg" } | |
| function Write-Err($msg){ Write-Host "[ERROR] $msg" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal enabledelayedexpansion | |
| :: Check if running as Administrator | |
| net session >nul 2>&1 | |
| if %errorLevel% neq 0 ( | |
| echo This script must be run with Administrator privileges. | |
| pause | |
| exit /b 1 | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # expand-disk.ps1 | |
| # Automatically expands system drive C on first boot | |
| # After execution, deletes the scheduled task and itself | |
| try { | |
| Write-Host "=== Automatic C drive expansion started ===" | |
| # Get the disk containing the C: partition | |
| $partition = Get-Partition -DriveLetter C | |
| $disk = Get-Disk -Number $partition.DiskNumber |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal EnableDelayedExpansion | |
| :: Check if running with administrator privileges | |
| net session >nul 2>&1 | |
| if %errorlevel% neq 0 ( | |
| echo This script requires administrator privileges! | |
| echo Please run as administrator. | |
| pause | |
| exit /b |