PowerShell

Check Version of PowerShell (localhost and remote hosts)

In this blog post I show how to find out the Version of PowerShell on the localhost and on remote computers.

The release number of the PowerShell version can be found in many ways: Registry, Skripts … and of course in PowerShell itself.

Checking version of PowerShell (localhost)

Open Windows PowerShell with administrative privileges. Run Get-Host with Select-Object.

Get-Host | Select-Object Version

Unbenannt.PNG

Simplified:


(Get-Host).Version

Unbenannt.PNG

More simplified:


$host.version

Unbenannt.PNG


$PSVersionTable.PSVersion

Unbenannt.PNG

User-friendly:


$host.version | Out-GridView

Unbenannt.PNG

User-friendly 2:


Write-Host (get-host).Version.Major (Get-Host).Version.Minor -Separator .

Unbenannt.PNG

Choose your favourite!

How to get PowerShell Version on Remote Hosts (Domain Environment)

Single Computer


Invoke-Command -Computername client001 -Scriptblock {$PSVersionTable.psversion}

Unbenannt.PNG

Client001 is running 5.1.

Multiple Computers

First, get a list of computer names by running Get-ADComputer. Then use that list to get the powershell version of all computers.


$adcomputer=(Get-ADComputer -Filter *).Name

Invoke-Command -ComputerName $adcomputer -Scriptblock {$PSVersionTable.psversion} -ErrorAction SilentlyContinue

Unbenannt.PNG

Cool. That looks good. All computers are up-to-date.

Non-Domain Computers

If the computers do not share the same domain, then you have to configure them as Trusted Hosts. For more information see my article PowerShell Remoting: How to connect to Remote Hosts in a Domain- and in a Non-Domain Environment (Trusted Hosts).

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s