Powershell's Invoke-Expression missing param

Tags: powershell
By : Guy
Source: Stackoverflow.com

I thought that I had the latest CTP of PowerShell 2 but when I try the command: invoke-expression –computername Server01 –command 'get-process PowerShell'

I get an error message: A parameter cannot be found that matches parameter name 'computername'.

So the question is: How can I tell which version of PowerShell I have installed? And what the latest version is?

By : Guy


$host.version.tostring() will return the version number.

RTM of v1 is

Couldn't honestly tell you what the latest version of the previews are because I haven't had a chance to play yet.

By : Kev

If the $PSVersionTable variable doesn't exist, then you are running V1.

If it exists, then the version will be available as $PSVersionTable.PSVersion.

function Get-PSVersion {  
    if (test-path variable:psversiontable) 

From last night's build (which means you might have this in CTP3 but if not, you'll get it in the next public drop):

[4120:0]PS> $psversiontable
Name                           Value
----                           -----
CLRVersion                     2.0.50727.3521
BuildVersion                   6.1.7047.0
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
PSRemotingProtocolVersion      2.0

Experiment! Enjoy! Engage!

Jeffrey Snover [MSFT] Windows Management Partner Architect

This video can help you solving your question :)
By: admin