# Ensure running as administrator if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Error "This script must be run as Administrator." exit 1 } # Define the path $FilePath = "C:\Windows\System32\config\OSDATA" # Create the file (empty file, no extension) New-Item -Path $FilePath -ItemType File -Force | Out-Null # Reboot the machine immediately Restart-Computer -Force