Run Sharepoint Powershell as a different user

In the other day i want to set a Pre-Prod stage and wanted to change the Continuous Crawl Interval using the known PS commands

$ssa = Get-SPEnterpriseSearchServiceApplication  
see more here

BUT!  i could not gain access to the search service, and kept getting this error:
format-default : Exception has been thrown by the target of an invocation.

Googling around i got the point that it was a permissions error, mainly from here where it was stated by BastianWebster that you need to do this with the user running the app pool.

now usually its either everything is running with the same super-user, or at least you get your super-user with permissions to rule-them-all, but not this time. i was sp_admin, and, funny as it is, the sp_search, running the pool for the SSA, was not allowed for RDP.

so i just tried to run SP Management Shell, the Sharepoint Powershell (SP PS lol) as a different user but could not!

many suggestions are around there, but maybe they are wrong, and maybe its just WIN 8.1 but here is the full drill:

1. Run CMD as Administrator
2. paste in the following command
    RunAs /u:domain\user “powershell”
    *notice that you need the domain even if you're within it
    *notice the slashes change directions
    *all this seems case sensitive
3. you will be asked for your password, dont miss!
4. copy-paste the shortcut for the SP Management Shell which is all that

    C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe  -NoExit  " & ' C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\CONFIG\POWERSHELL\Registration\\sharepoint.ps1 ' "

finally you have a fully running SP PS as another user, ye!!


Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem

JS/JQ simulate Enter event