imports system
imports system.directoryservices
imports system.io
public class iismanager
public shared function createwebsite(byval websitename as string, byval pathtoroot as string) as website
dim root as directoryentry = new directoryentry("iis://localhost/w3svc")
' find unused id value for new web site
dim siteid as integer = 1
dim e as directoryentry
for each e in root.children
if e.schemaclassname = "iiswebserver" then
dim id as integer = convert.toint32(e.name)
if id >= siteid then
siteid = id + 1