www.jayntguru.com

September 2, 2009

script: creating an app pool, application and assigning the pool to the application

Filed under: computer geek stuff — jayntguru @ 3:49 pm

As usual, this one was harder than it should have been. Granted, this task is pretty easy through the UI, but I have a bunch of environments to manage that must be the same… except for minor exceptions like the names of the site. Of course you have to supply the name of the site in these scripts. So what I did was find a way to output the name of the site based off the url of http://localhost and then set that to en environment variable that we use for the rest of the script.

You call this script with: scriptname vdirname path

******script******

set vdir=%1
set path=%2

echo %vdir%
echo %path%

%windir%\system32\inetsrv\appcmd add apppool /name:%vdir%

FOR /F "tokens=*" %%i in (‘%windir%\system32\inetsrv\appcmd list site http://localhost /text:site.name’) do SET IISSITENAME=%%i

%systemroot%\system32\inetsrv\APPCMD add app /site.name:%IISSITENAME% /path:/%vdir% /physicalPath:%path%

%systemroot%\system32\inetsrv\APPCMD set app "%IISSITENAME%/%vdir%" /applicationPool:%vdir%

******script******

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress