How do I find which Windows version I\'m using?
I\'m using PowerShell 2.0 and tried:
PS C:\\> ver
The term \'ver\' is not recognized as the name o
Windows PowerShell 2.0:
$windows = New-Object -Type PSObject |
Add-Member -MemberType NoteProperty -Name Caption -Value (Get-WmiObject -Class Win32_OperatingSystem).Caption -PassThru |
Add-Member -MemberType NoteProperty -Name Version -Value [Environment]::OSVersion.Version -PassThru
Windows PowerShell 3.0:
$windows = [PSCustomObject]@{
Caption = (Get-WmiObject -Class Win32_OperatingSystem).Caption
Version = [Environment]::OSVersion.Version
}
For display (both versions):
"{0} ({1})" -f $windows.Caption, $windows.Version