I’m doing some testing with ArcSDE direct connections and Windows Authentication, and needed a quick way to check how the settings were working for different users. Of course I could go to another PC, and login as one of the test users, or setup a bunch of virtual machines, log into each of them as different users, and test the connections that way, but it seemed like a lot of work when there is the “run as” command in Windows XP.
Basically “Run As” allows you to start up an application or process as a different Windows login. Here’s the syntax (showing how to start ArcMap)runas /user:your-domaintestuser /profile /savecred "C:Program FilesArcGISBinArcMap.exe"
So, I happliy created some test users on our domain, and whipped up a quick batch file, and ran it, expecting ArcMap to fire up as the specified user. Not quite. I got an error when ArcMap was spinning up – a totally generic “ArcMap has encountered a Problem and needs to close” error. Usually this is a really bad type of error, but before I got too wound up, I thought about things a little, and when ArcMap starts up for the first time, it writes a bunch of stuff into the users profile. But this user does not yet have a profile on my machine since they have never logged in!
So I logged myself out, and logged in as the test user – which created the profile. I then promptly logged out and back in as myself again. Now when I run the batch file – ArcMap happily starts up as the specified user. Nice. If you are using Windows Authentication with ArcSDE, this can be a useful tool – it can allow you to run in a more restricted mode most of the time, but when you need to you can switch over to a login which has rights to make schema modifications – without having to log out of your windows session.