VMware Cloud Community
dwcrist
Enthusiast
Enthusiast

What does the '@' sign do?

Hi, I'm new to both PowerShell and PowerCLI.  I took a 3-day MS Powershell class and didn't see the '@' construct.  I saw this on the getting-started page:

Get-VM | Get-FloppyDrive | select @{'n' = 'Name'; 'e' = { $_.Parent.Name} }, @{'n' = 'IsConnected'; 'e' = {$_.ConnectionState.Connected}}

Thanks,

Doug

0 Kudos
4 Replies
LucD
Leadership
Leadership

In this case the @ is used to specify a calculated property.

You specify a name (N) and an expression (E) for the property.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
MartinAmaro
Expert
Expert

This link might provide a more detail explanation of splatting

http://technet.microsoft.com/en-us/magazine/gg675931.aspx

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.
0 Kudos
dwcrist
Enthusiast
Enthusiast

Thanks, Luc and Martin.  That article at MS had a good explanation.  Although, when I think of 'splatting' normally paint comes to mind!  🙂

0 Kudos
LucD
Leadership
Leadership

I don't think that the Select-Object with a calculated property is splatting.

It is an interesting feature in PowerShell, but the example above is not splatting, I'm afraid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos