This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Starting with $TestReg = Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion'
I can individually get these values.
$TestReg.CurrentMajorVersionNumber = "10"
$TestReg.CurrentMinorVersionNumber = "0"
$TestReg.CurrentBuildNumber = "18363"
$TestReg.UBR = "592"
But I can't seem to glue these values together without creating and setting new variables first. I'm trying to find the most efficient way to do this for a specific script now but also the harder I search now, the more I want to know this for future projects.
I tried to concatenate "$var.name" "." "$var.name" etc but it stacks the entire $var together.
I tried to concatenate $var.name "." $var.name but it cannot combine system.int32
I tried using piping to Select, then Format-Table (to get rid of the select table headers) but then I remembered ft breaks the object pipeline if I recall correctly.
I've been googling for couple hours now and keep NOTing pieces like SQL and CSV but can't figure out how to do this.
What I want to do is get back the SCCM version "10.0.18363.592" string.
PS just in case that value is available somewhere else, I still would like to know how to break and build these pieces for future scripting.
Subreddit
Post Details
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...