xetup/assets/Backinfo/backinfo_W11.ps1
Filip Zubik c42943cfa8 PS scripts, web platform, Forgejo CI, xetup.exe launcher
Initial deployment suite for X9.cz MSP Windows 10/11 deployment:
- PowerShell scripts 00-11: admin account, bloatware removal, software (winget+Atera),
  system registry tweaks, default profile, personalization, scheduled tasks,
  BackInfo desktop info, Windows activation, PC identity/rename, network, Dell Update
- Web platform: xetup.x9.cz (nginx), spec/annotation page, /dl shortlink, GitHub mirror
- Forgejo Actions CI: auto-build xetup.exe on push, publish to releases/latest
- Go xetup.exe: embeds all scripts/assets, per-feature checkboxes, load/save config
2026-04-16 14:49:41 +02:00

60 lines
1.7 KiB
PowerShell

# ================================
# BackInfo OS detection script
# Writes OS name for BGInfo/BackInfo
# ================================
Set-ExecutionPolicy Unrestricted
$cvPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
$cv = Get-ItemProperty -Path $cvPath
# --- Detect OS by build number ---
$build = [int]$cv.CurrentBuild
if ($build -ge 22000) {
$osName = "Windows 11"
} else {
$osName = "Windows 10"
}
# --- Detect edition ---
switch ($cv.EditionID) {
"Professional" { $edition = "Pro" }
"ProfessionalN" { $edition = "Pro N" }
"Core" { $edition = "Home" }
"CoreN" { $edition = "Home N" }
"Enterprise" { $edition = "Enterprise" }
"Education" { $edition = "Education" }
default { $edition = $cv.EditionID }
}
$finalOSName = "$osName $edition"
# --- Registry paths for BackInfo (64bit + 32bit) ---
$regPaths = @(
"HKLM:\SOFTWARE\BackInfo",
"HKLM:\SOFTWARE\WOW6432Node\BackInfo"
)
foreach ($path in $regPaths) {
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
New-ItemProperty `
-Path $path `
-Name "OSName" `
-Value $finalOSName `
-PropertyType String `
-Force | Out-Null
}
# --- Optional output for logging ---
Write-Output "BackInfo OSName set to: $finalOSName"
$SourceFilePath = "C:\Program Files\BackInfo\BackInfo.exe"
$ShortcutPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\BackInfo.lnk"
$WScriptObj = New-Object -ComObject ("WScript.Shell")
$shortcut = $WscriptObj.CreateShortcut($ShortcutPath)
$shortcut.TargetPath = $SourceFilePath
$shortcut.Save()