VMware Cloud Community
marklemon
Enthusiast
Enthusiast
Jump to solution

The term 'Select-Object-Property' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I have a pretty new version of PowerCLI (5.5 Rel 1) and vCenter is 5.5 as is ESXi.

I also verified Automation.Core is installed:

PowerCLI C:\Windows\system32> Get-PSSnapin VMware.VimAutomation.Core

Name        : VMware.VimAutomation.Core

PSVersion   : 2.0

Description : This Windows PowerShell snap-in contains Windows PowerShell cmdle

              ts for managing vSphere.

but after connecting to vCenter, I get error trying to run:

PowerCLI C:\Windows\system32> $Results = ForEach ($DRSRule in $DRSRules)

>>      {

>>     "" | Select-Object-Property @{N="Cluster";E={(Get-View- Id $DRSRule.Clust

er.Id).Name}},

>>     @{N="Name";E={$DRSRule.Name}},

>>     @{N="Enabled";E={$DRSRule.Enabled}},

>>     @{N="DRS Type";E={$DRSRule.KeepTogether}},

>>     @{N="VMs";E={$VMIds=$DRSRule.VMIds -split ","

>>       $VMs = ForEach ($VMId in $VMIds)

>>         {

>>         (Get-View -Id $VMId).Name

>>         }

>>       $VMs -join ","}}

>>      }

>>

The term 'Select-Object-Property' is not recognized as the name of a cmdlet, fu

nction, script file, or operable program. Check the spelling of the name, or if

a path was included, verify that the path is correct and try again.

At line:3 char:32

+     "" | Select-Object-Property <<<<  @{N="Cluster";E={(Get-View- Id $DRSRule

.Cluster.Id).Name}},

    + CategoryInfo          : ObjectNotFound: (Select-Object-Property:String)

   [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

PowerCLI C:\Windows\system32> Add-PSSnapin VMware.VimAutomation.Core

Is 'Select-Object-Property not installed?  If not, where do I get it, please?

cheers

KC

note, I got this code from Dean here: PowerCLI: Retrieving DRS rules; Deans Blog

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

There should be a blank between Select-Object and the -Property parameter


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

There should be a blank between Select-Object and the -Property parameter


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

Reply
0 Kudos
marklemon
Enthusiast
Enthusiast
Jump to solution

Thanks LucD Smiley Happy

Reply
0 Kudos