Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Easily run the SharePoint Command Shell as a different user ID
@echo off
set PSshell="C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit & 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1'\""
runas /user:myDomain\ServiceAccountName /savecred %PSshell%
if errorlevel 1 pause
:end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment