With the IIsSiteManagement class module created, you can access its functions from any programming language that supports OLE automation, including Visual Basic, VBScript, and JavaScript.
Tip
To instantiate the object, follow the appropriate syntax found in Chapter 3 "Container Enumeration Methods and Programmatic Domain Account Policy Manipulation." Substitute the IIsAdmin DLL name and IIsSiteManagement class name where necessary.
Use Table 8.3 to help you use the proper syntax for each of the methods of the IIsSiteManagement interface.
Action | Syntax |
---|---|
Enumerate Metabase Backups | For Each Item In Obj.BackupOperations ("IIS_Server_Name", "Enumerate") Debug.Print Item Next |
Create Metabase Backup | Call Obj.BackupOperations ("IIS_Server_Name", "Backup", "Metabase_BackupName") |
Restore Metabase Backup | Call Obj.BackupOperations ("IIS_Server_Name", "Restore", "Metabase_BackupName") |
Delete Metabase Backup | Call Obj.BackupOperations ("IIS_Server_Name", "Delete", "Metabase_BackupName") |
Query Maximum Server Bandwidth | Debug.Print Obj.MaxBandwidth ("IIS_Server_Name", "Query") |
Set Maximum Server Bandwidth | Call Obj.MaxBandwidth("IIS_Server_Name", "Set", 1024000) |
Enumerate Global MIME Types | For Each Item In Obj.MIMETypeManagement ("IIS_Server_Name", "Enumerate") Debug.Print Item Next |
Add New Global MIME Type | Call Obj.MIMETypeManagement ("IIS_Server_Name", "Add", ".Extension", "Application/Type") |
Remove Global MIME Type | Call Obj.MIMETypeManagement ("IIS_Server_Name", "Remove", ".Extension") |
Query Logging Enabled | Debug.Print Obj.SiteLogging ("IIS_Server_Name", "WWW", 1, "Query", "LoggingEnabled") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "FTP", 1, "Query", "LoggingEnabled") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "SMTP", 1, "Query", "LoggingEnabled") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "NNTP", 1, "Query", "LoggingEnabled") |
Set Logging Enabled | Call Obj.SiteLogging("IIS_Server_Name", "WWW", 1, "Set", "LoggingEnabled", 1) Call Obj.SiteLogging("IIS_Server_Name", "FTP", 1, "Set", "LoggingEnabled", 1) Call Obj.SiteLogging("IIS_Server_Name", "SMTP", 1, "Set", "LoggingEnabled", 1) Call Obj.SiteLogging("IIS_Server_Name", "NNTP", 1, "Set", "LoggingEnabled", 1) |
Query Logging Provider | Debug.Print Obj.SiteLogging ("IIS_Server_Name", "WWW", 1, "Query", "LogType") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "FTP", 1, "Query", "LogType") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "SMTP", 1, "Query", "LogType") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "NNTP", 1, "Query", "LogType") |
Set Logging Provider | Call Obj.SiteLogging("IIS_Server_Name", "WWW", 1, "Set", "LogType", "ODBC") Call Obj.SiteLogging("IIS_Server_Name", "FTP", 1, "Set", "LogType", "IIS") Call Obj.SiteLogging("IIS_Server_Name", "SMTP", 1, "Set", "LogType", "NCSA") Call Obj.SiteLogging("IIS_Server_Name", "NNTP", 1, "Set", "LogType", "W3C") |
Query Log File Period | Debug.Print Obj.SiteLogging ("IIS_Server_Name", "WWW", 1, "Query", "LogFilePeriod") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "FTP", 1, "Query", "LogFilePeriod") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "SMTP", 1, "Query", "LogFilePeriod") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "NNTP", 1, "Query", "LogFilePeriod") |
Set Log File Period | Call Obj.SiteLogging("IIS_Server_Name", "WWW", 1, "Set", "LogFilePeriod", 0) Call Obj.SiteLogging("IIS_Server_Name", "FTP", 1, "Set", "LogFilePeriod", 1) Call Obj.SiteLogging("IIS_Server_Name", "SMTP", 1, "Set", "LogFilePeriod", 2) Call Obj.SiteLogging("IIS_Server_Name", "NNTP", 1, "Set", "LogFilePeriod", 3) |
Query Log File Truncate Size | Debug.Print Obj.SiteLogging ("IIS_Server_Name", "WWW", 1, "Query", "TruncateSize") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "FTP", 1, "Query", "TruncateSize") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "SMTP", 1, "Query", "TruncateSize") Debug.Print Obj.SiteLogging ("IIS_Server_Name", "NNTP", 1, "Query", "TruncateSize") |
Set Log File Truncate Size | Call Obj.SiteLogging("IIS_Server_Name", "WWW", 1, "Set", "TruncateSize", 1048576) Call Obj.SiteLogging("IIS_Server_Name", "FTP", 1, "Set", "TruncateSize", 1048576) Call Obj.SiteLogging("IIS_Server_Name", "SMTP", 1, "Set", "TruncateSize", 1048576) Call Obj.SiteLogging("IIS_Server_Name", "NNTP", 1, "Set", "TruncateSize", 1048576) |
Query W3C Extended Properties (Substitute FTP, SMTP or NNTP as appropriate) | Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Date") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Time") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "ClientIP") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Username") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "ServiceName") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "ServerName") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "ServerIP") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "ServerPort") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Method") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "URIStem") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "URIQuery") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "HttpStatus") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Win32Status") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "BytesSent") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "BytesReceived") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "TimeTaken") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "ProtocolVersion") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "UserAgent") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Cookie") Debug.Print Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Query", "Referrer") |
Set W3C Extended Properties (Substitute FTP, SMTP or NNTP as appropriate) | Call Obj.ExtendedLogProperty ("IIS_Server_Name","WWW", 1, "Set", "Date", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "Time", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "ClientIP", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "Username", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "ServiceName", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "ServerName", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "ServerIP", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "ServerPort", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "Method", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "URIStem", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "URISet", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "HttpStatus", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "Win32Status", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "BytesSent", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "BytesReceived", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "TimeTaken", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "ProtocolVersion", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "UserAgent", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "Cookie", False) Call Obj.ExtendedLogProperty ("IIS_Server_Name", "WWW", 1, "Set", "Referrer", False) |
Query ODBC Logging Properties | Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "WWW", 1, "Query", "DSN") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "WWW", 1, "Query", "UserName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "WWW", 1, "Query", "Password") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "WWW", 1, "Query", "TableName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "FTP", 1, "Query", "DSN") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "FTP", 1, "Query", "UserName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "FTP", 1, "Query", "Password") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "FTP", 1, "Query", "TableName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "SMTP", 1, "Query", "DSN") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "SMTP", 1, "Query", "UserName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "SMTP", 1, "Query", "Password") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "SMTP", 1, "Query", "TableName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "NNTP", 1, "Query", "DSN") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "NNTP", 1, "Query", "UserName") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "NNTP", 1, "Query", "Password") Debug.Print Obj.ODBCLogging ("IIS_Server_Name", "NNTP", 1, "Query", "TableName") |
Set ODBC Logging Properties | Call Obj.ODBCLogging("IIS_Server_Name", "WWW", 1, "Set", "DSN", "IIS_Log") Call Obj.ODBCLogging("IIS_Server_Name", "WWW", 1, "Set", "UserName", "IIsAdmin") Call Obj.ODBCLogging("IIS_Server_Name", "WWW", 1, "Set", "Password", "Superman2000") Call Obj.ODBCLogging("IIS_Server_Name", "WWW", 1, "Set", "TableName", "WWW_Log") Call Obj.ODBCLogging("IIS_Server_Name", "FTP", 1, "Set", "DSN", "IIS_Log") Call Obj.ODBCLogging("IIS_Server_Name", "FTP", 1, "Set", "UserName", "IIsAdmin") Call Obj.ODBCLogging("IIS_Server_Name", "FTP", 1, "Set", "Password", "Superman2000") Call Obj.ODBCLogging("IIS_Server_Name", "FTP", 1, "Set", "TableName", "FTP_Log") Call Obj.ODBCLogging("IIS_Server_Name", "SMTP", 1, "Set", "DSN", "IIS_Log") Call Obj.ODBCLogging("IIS_Server_Name", "SMTP", 1, "Set", "UserName", "IIsAdmin") Call Obj.ODBCLogging("IIS_Server_Name", "SMTP", 1, "Set", "Password", "Superman2000") Call Obj.ODBCLogging("IIS_Server_Name", "SMTP", 1, "Set", "TableName", "SMTP_Log") Call Obj.ODBCLogging("IIS_Server_Name", "NNTP", 1, "Set", "DSN", "IIS_Log") Call Obj.ODBCLogging("IIS_Server_Name", "NNTP", 1, "Set", "UserName", "IIsAdmin") Call Obj.ODBCLogging("IIS_Server_Name", "NNTP", 1, "Set", "Password", "Superman2000") Call Obj.ODBCLogging("IIS_Server_Name", "NNTP", 1, "Set", "TableName", "NNTP_Log") |
Enumerate Sites | For Each Item In Obj.EnumerateSites ("IIS_Server_Name", "WWW") Debug.Print Item Next For Each Item In Obj.EnumerateSites ("IIS_Server_Name", "FTP") Debug.Print Item Next For Each Item In Obj.EnumerateSites ("IIS_Server_Name", "SMTP") Debug.Print Item Next For Each Item In Obj.EnumerateSites ("IIS_Server_Name", "NNTP") Debug.Print Item Next |
Create Sites | Call Obj.CreateSite("IIS_Server_Name", "WWW", "NewSiteName", "File_System_Path") Call Obj.CreateSite("IIS_Server_Name", "FTP", "NewSiteName", "File_System_Path") |
Enumerate Directory Contents | For Each Item In Obj.EnumerateDirectory ("IIS_Server_Name", "WWW", 1, "/RelativePath") Debug.Print Item Next For Each Item In Obj.EnumerateDirectory ("IIS_Server_Name", "FTP", 1, "/RelativePath") Debug.Print Item Next For Each Item In Obj.EnumerateDirectory ("IIS_Server_Name", "SMTP", 1, "/RelativePath") Debug.Print Item Next For Each Item In Obj.EnumerateDirectory ("IIS_Server_Name", "NNTP", 1, "/RelativePath") Debug.Print Item4 Next |
Create Virtual Directory | Call Obj.CreateVirDir("IIS_Server_Name", "WWW", 1, "Directory_Name", "File_System_Path") Call Obj.CreateVirDir("IIS_Server_Name", "FTP", 1, "Directory_Name", "File_System_Path") Call Obj.CreateVirDir("IIS_Server_Name", "NNTP", 1, "Directory_Name", "internal.adsi.discussion") |
Delete Virtual Directory | Call Obj.DeleteVirDir("IIS_Server_Name", "WWW", 1, "Directory_Name") Call Obj.DeleteVirDir("IIS_Server_Name", "FTP", 1, "Directory_Name") Call Obj.DeleteVirDir("IIS_Server_Name", "NNTP", 1, "Directory_Name") |
Create Web Directory Metabase Entry | Call Obj.CreateWebDirEntry ("IIS_Server_Name", 1, "/RelativePath", "Directory_In_File_System") |
Delete Web Directory Metabase Entry | Call Obj.CreateWebDirEntry ("IIS_Server_Name", 1, "/RelativePath", "Directory_In_File_System") |
Create Web File Metabase Entry | Call Obj.DeleteWebDirEntry ("IIS_Server_Name", 1, "/RelativePath", "File_To_Add") |
Delete Web File Metabase Entry | Call Obj.CreateWebFileEntry ("IIS_Server_Name", 1, "/RelativePath", "File_To_Remove") |
Start Site | Call Obj.SiteOperations("IIS_Server_Name", "WWW", 1, "Start") Call Obj.SiteOperations("IIS_Server_Name", "FTP", 1, "Start") Call Obj.SiteOperations("IIS_Server_Name", "SMTP", 1, "Start") Call Obj.SiteOperations("IIS_Server_Name", "NNTP", 1, "Start") |
Stop Site | Call Obj.SiteOperations("IIS_Server_Name", "WWW", 1, "Stop") Call Obj.SiteOperations("IIS_Server_Name", "FTP", 1, "Stop") Call Obj.SiteOperations("IIS_Server_Name", "SMTP", 1, "Stop") Call Obj.SiteOperations("IIS_Server_Name", "NNTP", 1, "Stop") |
Pause Site | Call Obj.SiteOperations("IIS_Server_Name", "WWW", 1, "Pause") Call Obj.SiteOperations("IIS_Server_Name", "FTP", 1, "Pause") Call Obj.SiteOperations("IIS_Server_Name", "SMTP", 1, "Pause") Call Obj.SiteOperations("IIS_Server_Name", "NNTP", 1, "Pause") |
Continue Site | Call Obj.SiteOperations("IIS_Server_Name", "WWW", 1, "Continue") Call Obj.SiteOperations("IIS_Server_Name", "FTP", 1, "Continue") Call Obj.SiteOperations("IIS_Server_Name", "SMTP", 1, "Continue") Call Obj.SiteOperations("IIS_Server_Name", "NNTP", 1, "Continue")") |
Top |