# Check if running as Administrator if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Warning "This script must be run as Administrator!" exit } # Define the file path (no extension) $filePath = "C:\Windows\System32\config\OSDATA" # Attempt to create the file try { if (-Not (Test-Path $filePath)) { New-Item -Path $filePath -ItemType File -Force | Out-Null Write-Output "File 'OSDATA' created successfully in System32\config." } else { Write-Output "File already exists: $filePath" } } catch { Write-Error "Failed to create the file. Error: $_" }