blog@mcZen

Software, life, and leisure

IISReset on a remote machine

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

September 16, 2007 5:17 AM

mike

When touching a web.config file isn't enough to allow you to swap out some dlls that you need to replace, iisreset will often do the trick. But when you're testing on a remote machine, this can be tedious and time consuming, especially when you have to remote desktop into the machine to reset iis and copy the dlls because there was a sharing violation.

Well, we are in luck because of runas. Runas allows you to login as someone else somewhere else. Note: this is not the same as "Run as Administrator" on VISTA/XP!

C:\>runas /noprofile /netonly /user:[username@domain] cmd
Enter the password for username@domain:
Attempting to start cmd as user "username@domain"

*NEW WINDOW*

C:\>iisreset MachineName

Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted

C:\>xcopy /Y my.dll \\MachineName\C$\inetpub\app_bin\
...
1 File(s) copied

Another fine utility is touch. I remember this from my UNIX days as being worthy as a windows utility. It allows you to "Touch" the file as if it has been modified. Touching the file may allow you to replace the dlls in the app_bin folder. (As a side note, in general, the app_bin folder is just a temp folder as the dlls get pushed down into the windows directory, but this is not necessarily true for all occasions, Sharepoint 2007 in particular.)

Here is a link for a touch program I found in 2 seconds on google... There are many out there and this is probably easy to write on your own if you're wanting to learn. Freeware! FMX Touch (for MS Windows) by Gregory Braun. If you're more into how than why, go download the commandline utility from code project: Touch for Windows.
Comments are closed

Powered by BlogEngine.NET 1.4.5.7