tags:

views:

1387

answers:

7

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?

+2  A: 

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

RTM of v1 is 1.0.0.0

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

HTH

Kev
A: 

Thanks - just ran that and got 2.0

Just found the CTP and see that it was published on 11/5/2007 so I now know that I have the latest.

It's a mystery to me why that param is not recognized.

Guy
+1  A: 

The latest CTP is CTP2 released on 05/02/08 and can be found here. Remoting requires WinRM to be installed on both the calling machine and the target machine. Included in the CTP is a script to configure WS-Management called Configure-WSMan.ps1.

This command should get you the version number of PowerShell that you have installed. Get-Command "$PSHome\powershell.exe" | Format-List FileVersionInfo V1.0 is 6.0.5430.0 CTP2 is 6.1.6585.1

I don't have the version number for the first CTP on hand, but I can find it if you really need it.

Steven Murawski
A: 

I'm guessing that this is a change to the cmdlet made during the configuration process Configure-Wsman.ps1. I don't have an environment setup to test right now, but I'm guessing something went wrong with the configuration. I can verify that on XP the parameter is not available (duh). I'd assume that you will find the same on Vista/08 without the configuration completed.

slipsec
+2  A: 

The problem is that from CTP 1 to CTP2, they switched up the Invoke stuff, all the remoting stuff is done through Invoke-Command now, and Invoke-Expression is solely for turning a string into a script ;)

P.S.: If you're on v2 you can run $PSVersionTable to see a list of versions including the CLR and Build versions.

Jaykul
+2  A: 

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}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.0

Experiment! Enjoy! Engage!

Jeffrey Snover [MSFT] Windows Management Partner Architect

Jeffrey Snover - MSFT
A: 

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) {$psversiontable.psversion} else {[version]"1.0.0.0"}
}

aleksandar