Automation

 View Only
  • 1.  What does the '@' sign do?

    Posted Mar 29, 2011 06:23 PM

    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



  • 2.  RE: What does the '@' sign do?

    Posted Mar 29, 2011 07:49 PM

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

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



  • 3.  RE: What does the '@' sign do?

    Posted Mar 29, 2011 07:52 PM

    This link might provide a more detail explanation of splatting

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



  • 4.  RE: What does the '@' sign do?

    Posted Mar 29, 2011 08:12 PM

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



  • 5.  RE: What does the '@' sign do?

    Posted Mar 29, 2011 08:56 PM

    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.