######################################################################################################################################################################################################################################################################################################## ################## # # i "m Not Sure if you need to use book of these modules, but my code does for Some Unknown Reason use win32 :: ole; use ole;
Use sys :: hostname; $ computer = hostname ();
########## # Begin block of code to add virtual roots ######### # get default web site object $ Websvc = Win32 :: ole-> getObject ("IIS: / / $ COMPUTER / W3SVC / 1 ") || DIE" Could Not Create Web Service Object: $! ";
# Get root of default web site $ void = $ Websvc-> getObject ("IisWebVirtualDir", "root") || DIE "COULD NOT CREATE ROOT OF DEFAULT Web Site Object: $!";
# Define% vroots as such:% vroots = ('vroot1' => {read => 1, execute => 1, Path => 'Web'}, 'vroot2' => {read => 0, Execute => 1 , Path => 'Webbin'},);
Foreach $ root (sort keys% vroots) {# delete it in case it is already there! $ vdir = $ vroot-> delete ("IisWebVirtualDir", $ root;
$ vdir = $ vroot-> Create ("IisWebVirtualdir", $ root) || Next;
# Assign Parameters $ VDIR -> {path} = "$ basedir // $ vroots {$ root} -> {path}; $ vdir -> {accessRead} = $ vroots {$ root} -> {}; Vdir -> {AccessExecute} = $ vroots {$ root} -> {execute};
$ vdir-> setInfo;
}
##########
# End block of code to add virtual roots
##########
########## # Begin block of code to change Various property ########## $ w3svc = win32 :: ole-> getObject ("IIS: // $ Computer / W3SVC" ) || die "Could not get object: $!"; $ w3svc -> {AnonymousPasswordSync} = 0; $ w3svc -> {AnonymousUserName} = $ AnonymousUser; $ w3svc -> {AnonymousUserPass} = $ AnonymousPass; $ w3svc-> {Cgitimeout} = 86400; $ w3svc -> {createprocessasuser} = 1; $ w3svc-> setInfo; $ w3svc = win32 :: ole-> getobject ("IIS: // $ Computer / W3SVC / 1") || DIE " Could Not get Object: $! "; $ W3svc -> {cgitimeout} = 86400; $ w3svc-> setInfo; ########## # End block of code to change property ####### ###
# Some items in The Metabase Are More Complex Then Simple Scalars Like The Above
########## # Begin Block of code to change mimemap - please excuse the "not-as-elegant-as-it-could-be" code ########## $ MimeMap = Win32 :: OLE-> GetObject ("IIS: // $ Computer / MimeMap) || Die" Could Not Create MimeMap Object: $! ";; $ Amimemap = $ MIMEMAP-> getEx (" mimemap ") | | DIE "COULD NOT RETRIEVE MAPPINGS: $!";
$ alleadythere = 0;
# Add an entry in the mime map for png for ($ i = 0; $ i <@ {$ amimemap}; $ i ) {($ alleadythere = 1, last) IF (LC ($ AmimeMap -> [$ I] -> {EXTENSION}) EQ '.png');
}
IF (! $ alreadythere) {
$ newmimemap = creteObject ole "MimeMap" || DIE "Could Not do this: $!";
$ newmimemap -> {extension} = '.png'; $ newmimemap -> {mimetype} = 'image / png';
Push @ {$ amimemap}, $ newmimemap;
# Must Use Putex Method to Set The Value $ MIMEMAP-> Putex (2, "MimeMap", $ AmimeMap;
$ mimemap-> setInfo;
}
##########
# END block of code to change mimemap ##########
######################################################################################################################################################################################################################################################################################################## ###################
#