Posts

Showing posts with the label sharepoint powershell

Windows run as a different user from CMD

 On my journey to fix my dev env I learned some cool trick on how to run stuff in windows as another user, from CMD * For running the .exe files you need to navigate to their folders or run full path The basic operation to run as user is runas /netonly /user:<DOMAIN>\<USER> <COMMAND> So, for example domain is MyDom, and user is OthrUsr - Just open CMD runas /netonly /user:MyDom\OthrUsr cmd - Open PowerShell cd "C:\Windows\System32\WindowsPowerShell\v1.0\" runas /netonly /user: MyDom\OthrUsr  PowerShell.exe - Open SharePoint PowerShell cd "C:\Windows\System32\WindowsPowerShell\v1.0\" runas /netonly /user: MyDom\OthrUsr  PowerShell.exe . "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\CONFIG\POWERSHELL\Registration\SharePoint.ps1" *According to your SP version the "16" might be 15 (for sp13) or 14 (for sp10) - Open SQL Server Management Studio (SSMS)  (path can chage according to version) cd "C:\Progr...

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   $ssa.S etProperty("ContinuousCrawlInterval",20) 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...