Tuesday 10 March 2009

How to Get "Run As" Context Menu in Vista/Windows 2008 for running SharePoint 2007 stsadm.exe

To run the SharePoint Administration tool Stsadm.exe on a SharePoint 2007 server, you must run as a SharePoint Server Farm Administrator - otherwise you will just get a blunt "Access Denied." error message. Trying to run any stsadm command whatsoever will be met with the same terse response. This is because the local administrator (when the database is on a separate server to MOSS) will not have sufficient privileges on your MOSS Content database.

Today, I needed to run stsadm.exe on a Windows 2K8 server. However, I didn't want to log off and log back on as another user every time I wanted to do this. Unfortunately, now Vista and Windows 2K8 "Run As" functionality only supports running as a local administrator - not a specific user anymore (e.g. like the SharePoint farm administrator account defined on another server - in Active Directory). Others have also complained about this issue on Microsoft Connect - https://connect.microsoft.com/WindowsServerFeedback/feedback/ViewFeedback.aspx?FeedbackID=329528

There are 2 options to get around this issue without logging off and on as another user:

1) Use the commandline RunAs tool (if you like a lot of typing or prefer batch files - see my previous entry at http://ddkonline.blogspot.com/2008/06/using-impersonation-batch-files-and.html)
2) Use ShellRunAs. Thankfully, the hardworking guys at Sysinternals have the following tool which allows you to add the Context menu for Run As back where it should be:

http://technet.microsoft.com/en-us/sysinternals/cc300361.aspx

To install this command in the context menu, you can simply use the following:

ShellRunas.exe /reg

Et VoilĂ ! - instant RunAs goodness shall return to your context menu.


No comments: