Multiple line or array to one line (Example: Windows Version)

Aus Wiki-WebPerfect
Version vom 6. April 2018, 09:49 Uhr von Admin (Diskussion | Beiträge)

(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Multiple line or array to one line

Multiple line or array

 CurrentMajorVersionNumber","CurrentMinorVersionNumber","CurrentBuildNumber","ReleaseId","UBR" | foreach {((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").$_)}

Output

10
0
14393
1607
2156

Format Multiple line or array to one line (with "." between) - Display Windows Version (incl. Patchlevel)

 ("CurrentMajorVersionNumber","CurrentMinorVersionNumber","CurrentBuildNumber","ReleaseId","UBR" | foreach {((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").$_)}) -join "."