====== OS: Commandes utiles ======
===== Windows 10 =====
==== Récupérer le Release ID ====
Récupérer l'information ReleaseID via une intérogration dans la base de registre de Windows 10, merci à [[https://nas.wuibaille.fr/wordpress/wiki/powershell-get-release-id-windows-10/|David]] pour cette trouvaille
$ReleaseId = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
$ReleaseId
Résultat :\\
{{:script:powershell:os:2020-01-13_11_51_37-windows_powershell_ise.png?800|}}
==== Récupérer les informations de version sans passer par du WMI ====
# Version Intégrale
([System.Environment]::OSVersion.Version).ToString()
# Build uniquement
([System.Environment]::OSVersion.Version.Build).ToString()
# Information Major
([System.Environment]::OSVersion.Version.Major).ToString()
Résultat :\\
{{:script:powershell:os:2020-01-13_11_53_17-windows_powershell_ise.png|}}
==== Convertir une build en Nom ====
[string]$Version = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId
$Edition = switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
{
10240 { '1507' }
10586 { '1511' }
14393 { '1607' }
15063 { '1703' }
16299 { '1709' }
17134 { '1803' }
17763 { '1809' }
18362 { '1903' }
18363 { '1909' }
19041 { '2004' }
19042 { '20H2' }
19043 { '21H1' }
21390 { '21H2' }
default { 'Unknown' }
}
$Edition
==== Ouvrir l'un des menus parametres de Windows 10 ====
& C:\Windows\System32\control.exe /name Microsoft.WindowsUpdate
==== Récupérer les MUI installés ====
$Wmi_OS = Get-CimInstance -ClassName "Win32_OperatingSystem" -Namespace "root\CIMV2"
$GetMUILanguages = $Wmi_OS.MUILanguages