Robba's Weblog

My thoughts on Tech and life.

June 2007 - Posts

IIS 6.0 website update script using Adsutil.vbs

The previous script I put up was great if you're running IIS 7.0, but there aren't too many people out there running it.  I've done the same thing for IIS 6.0 and I'm including it here.  The only change is that rather than using AppCmd.exe like you would in IIS 7.0 we use adsutil.vbs.  I've tried replacing WinRAR with the built in compact /u command, but I'm not a big fan of it.  I really recommend installing WinRAR.

*********************************************************************************************** 

echo off

Set /P src=[old folder date]
Set /P Dest=[new folder date]
Set /P RARFile=[Name of Rar file]

xcopy c:\test\site1\%src% c:\test\site1\%dest% /o /e /y /c /i

"c:\program files\winrar\rar.exe" e -o+ -y c:\test\%rarfile% c:\test\site1\%dest%\

cscript.exe c:\inetpub\adminscripts\adsutil.vbs set w3svc/1/root/path "c:\test\site1\%dest%"

Echo "Site Update Complete"

************************************************************************************************
 

I didn't mention it before, but just copy the text in between the "*" into a batch file and you can run it or create a task to run it at specified times.  Great for that middle of the night update that you don't want to be awake for.  ***Disclaimer:  I really don't recommend updating a production environment without watching it and being in control.  You never know when something might go wrong.***  Well I hope it helps.
 

Posted: Jun 13 2007, 07:49 PM by robba | with no comments
Filed under: ,
Use AppCmd to create update script for IIS websites

Here at Telligent when we update an existing website our normal procedure is to make an XCopy of the current web folder, apply the updates and then point IIS at the new folder.  This gives us a couple of advantages.  The first advantage being that we always have a backup that we can fail back to if there is any problem with the update we just performed. The second advantage is we don't have to worry about files being locked and unable to overwrite.  The final advantage is that by pointing IIS at the new folder it automatically forces an application pool reset. 

Lately I've had the chance to play with IIS 7.0 and the new AppCmd.exe tool.  With it I've been able to create a script that prompts for source and destination directories as well as extracting files from a WinRAR archive and then points IIS to the new web folder.  I thought I'd share the script here:

echo off

Set /P src=[old folder date]
Set /P Dest=[new folder date]
Set /P RARFile=[Name of Rar file]

xcopy c:\test\site1\%src% c:\test\site1\%dest% /o /e /y /c /i

"c:\program files\winrar\rar.exe" e -o+ -y c:\test\%rarfile% c:\test\site1\%dest%\

"c:\windows\system32\inetsrv\appcmd.exe" set vdir site1/ -physicalpath:c:\test\site1\%dest%

Echo "Site Update Complete"

I'm really looking forward to using IIS 7.0 in our production environments because with the new AppCmd.exe tool it is possible completely control everything IIS does with just one tool. 

I've had to make a correction.  The physical path to the vdir wasn't being set properly.  It needs the full path that I have added and highlighted.
 

Posted: Jun 11 2007, 10:20 PM by robba | with 3 comment(s)
Filed under: ,
Boy life gets busy

Well, its been way too long since I actually posted anything on here.  I'm sure some people think ahh, just another blog here today and gone tomorrow.  Things have been really hectic, we've got the Exchange migration that is almost at the critical point and ready to do the change over, we're doing a large internal SQL consolidation, and we're trying out MS CRM 3.0.  Let me tell ya, all of those at once is a handful in addition to the daily stuff.  Oh yeah did I mention setting up 12 machines for new people?  Rick really does a great job helping me focus on the things I have to do while he takes care of everything else.  The only thing that has been technically challenging is the CRM reporting server connection and I tell you I even stumped Microsoft with getting the config to work.  So this week or next I'll build a virtual machine and put a pure instance of CRM on it to see if that resolves the issues.  I know I've mentioned it before, but I am really excited about getting Exchange internal.  I keep finding new nifty things that can be done in it.  I guess that about wraps it up for the time being, but I'll try to post a little more often even if I don't have an answer that saves the world.  Stick out tongue

Posted: Jun 04 2007, 11:57 PM by robba | with 1 comment(s)
Filed under: ,