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());
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to