Skip to content

Instantly share code, notes, and snippets.

@DavidWise
Created December 4, 2012 17:10
Show Gist options
  • Save DavidWise/4206364 to your computer and use it in GitHub Desktop.
Save DavidWise/4206364 to your computer and use it in GitHub Desktop.
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