2
votes

I am getting an error when starting SharePoint Management Shell for SP2013 on Windows Server 2012.

select : The term 'Select-Object' 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. At C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\15\CONFIG\POWERSHELL\Registration\SharePoint.ps1:1 char:16

  • $ver = $host | select version
  • ~~~~~~
    • CategoryInfo : ObjectNotFound: (Select-Object:String) [], Comma ndNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

do I need to import any modules ? If so, from where ?

1
Where is your code? Select-Object generally receives from piped inputs, Get-Awesomeness | Select-Object AwesomePerson, TheirAddressAustin T French
@AthomSfere how does that problem relate to this? It's clearly stating that Select-Object isn't recognized as a commandlet. Take $null or an object without a version property and pipe it to Select .. you won't have this problem.Chris N
@ChrisN Select is an alias for Select-Object, like gci is an alias for Get-ChildItem. It is almost certainly a syntax error, but need some code to see whats going on.Austin T French
They alias is setup, but the select-object command isn't loaded. Simply read the error. It's in English.Chris N
@PradeepNulu Can you simply open a regular powershell window and then import the sharepoint cmdlets like so: Add-PSSnapin "Microsoft.SharePoint.PowerShell"Chris N

1 Answers

2
votes

I got work around for my problem.

Mine is an SharePoint 2013 box. I found $env:psmodulepath as C:\Users\user_name\Documents\WindowsPowerShell\Modules;;C:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules;C:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules As you can notice that AppFabric module path has repeated itself. I guess AppFabric has messed up with the psmodulepath while it got installed. So, I modified the PSModulePath variable under registry (at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment) to include ;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules After this change, I am able to execute select & other basic cmdlets.

Thanks, Pradeep Nulu