[Tutor] IIS and Virtual directories
Todd Dahl
lucidmonk at gmail.com
Wed Nov 22 20:26:49 CET 2006
I have been trying to figure out how to create an IIS Virtual Directory
through Python but can't find anything that works. I have done it in the
past with Perl with the script below but can't seem to figure out how to do
it in Python. I was wondering if someone could point me in the right
direction.
Thank you,
-Todd
P.S."Hope everyone who reads this has a nice Thanksgiving!"
=============
##########################################################################
# Description: Use ADSI to create IIS virtual #
##########################################################################
use Win32::OLE;
my $server = "localhost";
my $VirtualDir = "AIRAdmin";
mkdir("nhvrweb",0777);
eval{
#Create WWW directory
#Check if the directory already exsist
if (! ($www =
Win32::OLE->GetObject("IIS://$server/W3svc/1/Root/$VirtualDir")))
{
$www = Win32::OLE->GetObject("IIS://$server/W3svc/1");
$vRoot = $www->GetObject("IIsWebVirtualDir", "Root");
$vDir = $vRoot->Create("IIsWebVirtualDir",$VirtualDir);
$vDir->{AccessScript} = 1;
$vDir->{Path} = "C:\\nhvr\\$VirtualDir";
$vDir->SetInfo();
$vDir->AppCreate(1);
}
};
#In case of error
print Win32::OLE->LastError()."\n"if(Win32::OLE->LastError());
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061122/ca5fe031/attachment.htm
More information about the Tutor
mailing list