There are two ways to check/resolve the issue. Basically it's related to
the SP PowerShell console being not run for your login account.
1. Actually this issue belongs -
PowerShell version being used/installed in SP environment. Generally for SP 2010 the version would be 2.0, however, if you install Windows Management Framework 3.0, which will install PowerShell version 3.0. So we have make sure that , our PowerShell should take 2.0 version.
No worries, it's easy to find and update the same.
To find which version, run following command in your SP PowerShell management console.
$version = $host | select version
$version.Version
If you receive something like below. If the Major version is not on 2, then you will get this runtime error.
Major Minor Build Revision
—– —– —– ——–
3 0 -1 -1
Which means that, you console is running with 3.0 versions. Relax, there is way to point to 2.0 version.
How?
a) Go back to the SharePoint 2010 Management Shell Shortcut, right click and select “Properties”
Under the Shortcut tab, Target: section, insert "-version 2″ into the path. Make sure its before the -NoExit.
b) C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 2 -NoExit ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ “
c) Click apply, and then Ok.
d) Launch SP PowerShell console. That’s it.. Done.
Note: If this approach doesn't work, please follow point 2 below.
2. Check whether your login account had farm access or not by using following PowerShell command
Get-SPShellAdmin - if you get same error, it means that, you don't access to farm.
Then login with account which has full rights on farm and run following command to add the user.
Add-SPShellAdmin -username DOMAIN\userid
And also grant full rights on farm configuration db (generally SharePoint_Config, however, it may vary based on your org needs) & SharePoint admin content db.
1. Actually this issue belongs -
PowerShell version being used/installed in SP environment. Generally for SP 2010 the version would be 2.0, however, if you install Windows Management Framework 3.0, which will install PowerShell version 3.0. So we have make sure that , our PowerShell should take 2.0 version.
No worries, it's easy to find and update the same.
To find which version, run following command in your SP PowerShell management console.
$version = $host | select version
$version.Version
If you receive something like below. If the Major version is not on 2, then you will get this runtime error.
Major Minor Build Revision
—– —– —– ——–
3 0 -1 -1
Which means that, you console is running with 3.0 versions. Relax, there is way to point to 2.0 version.
How?
a) Go back to the SharePoint 2010 Management Shell Shortcut, right click and select “Properties”
Under the Shortcut tab, Target: section, insert "-version 2″ into the path. Make sure its before the -NoExit.
b) C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -version 2 -NoExit ” & ‘ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ‘ “
c) Click apply, and then Ok.
d) Launch SP PowerShell console. That’s it.. Done.
Note: If this approach doesn't work, please follow point 2 below.
2. Check whether your login account had farm access or not by using following PowerShell command
Get-SPShellAdmin - if you get same error, it means that, you don't access to farm.
Then login with account which has full rights on farm and run following command to add the user.
Add-SPShellAdmin -username DOMAIN\userid
And also grant full rights on farm configuration db (generally SharePoint_Config, however, it may vary based on your org needs) & SharePoint admin content db.
No comments:
Post a Comment