internal static void CreateOmaVDir(string metabasePath, VirtualDirectoryRole role) { MetabasePropertyTypes.AppPoolIdentityType appPoolIdentityType = MetabasePropertyTypes.AppPoolIdentityType.LocalSystem; if (IisUtility.WebDirObjectExists(metabasePath, "oma")) { string hostName = IisUtility.GetHostName(metabasePath); string appPoolRootPath = IisUtility.GetAppPoolRootPath(hostName); using (DirectoryEntry directoryEntry = IisUtility.FindWebObject(appPoolRootPath, "MSExchangeOWAAppPool", "IIsApplicationPool")) { IisUtility.SetProperty(directoryEntry, "AppPoolIdentityType", appPoolIdentityType, true); directoryEntry.CommitChanges(); } return; } CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = "oma"; createVirtualDirectory.Parent = metabasePath; createVirtualDirectory.LocalPath = OwaVirtualDirectoryHelper.OwaCafePath; createVirtualDirectory.CustomizedVDirProperties = OwaVirtualDirectoryHelper.GetOmaVDirProperties(role); createVirtualDirectory.ApplicationPool = "MSExchangeOWAAppPool"; createVirtualDirectory.AppPoolIdentityType = appPoolIdentityType; createVirtualDirectory.AppPoolManagedPipelineMode = MetabasePropertyTypes.ManagedPipelineMode.Integrated; createVirtualDirectory.AppPoolQueueLength = 10; createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); }
internal static void CreateLegacyVDirs(string metabasePath, bool deleteObjectIfExists) { string webSiteRoot = IisUtility.GetWebSiteRoot(metabasePath); IList legacyVirtualDirectories = OwaVirtualDirectoryHelper.GetLegacyVirtualDirectories(); if (legacyVirtualDirectories != null) { ArrayList arrayList = new ArrayList(); arrayList.Add(new MetabaseProperty("HttpRedirect", "/owa")); string localPath = Path.Combine(ConfigurationContext.Setup.InstallPath, "ClientAccess\\owa"); OwaVirtualDirectoryHelper.CreatedLegacyVDirs.Clear(); foreach (object obj in legacyVirtualDirectories) { string text = (string)obj; if (deleteObjectIfExists && IisUtility.WebDirObjectExists(webSiteRoot, text)) { IisUtility.DeleteWebDirObject(webSiteRoot, text); } CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = text; createVirtualDirectory.Parent = webSiteRoot; createVirtualDirectory.LocalPath = localPath; createVirtualDirectory.CustomizedVDirProperties = arrayList; createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); OwaVirtualDirectoryHelper.CreatedLegacyVDirs.Add(text); } } }
protected virtual bool CreateToMetabase() { bool result = false; T dataObject = this.DataObject; int num = dataObject.MetabasePath.LastIndexOf('/'); T dataObject2 = this.DataObject; string text = dataObject2.MetabasePath.Substring(0, num); T dataObject3 = this.DataObject; string text2 = dataObject3.MetabasePath.Substring(num + 1); if (!this.FailOnVirtualDirectoryAlreadyExists()) { T dataObject4 = this.DataObject; if (IisUtility.Exists(dataObject4.MetabasePath, "IIsWebVirtualDir")) { IisUtility.DeleteWebDirObject(text, text2); } } CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = text2; createVirtualDirectory.Parent = text; createVirtualDirectory.LocalPath = this.Path; createVirtualDirectory.ApplicationPool = this.AppPoolId; createVirtualDirectory.AppPoolIdentityType = this.AppPoolIdentityType; createVirtualDirectory.AppPoolManagedPipelineMode = this.AppPoolManagedPipelineMode; createVirtualDirectory.CustomizedVDirProperties = this.CustomizedVDirProperties; if (!string.IsNullOrEmpty(createVirtualDirectory.ApplicationPool) && this.LimitMaximumMemory) { ulong totalPhysicalMemory = new ComputerInfo().TotalPhysicalMemory; createVirtualDirectory.MaximumPrivateMemory = (long)(totalPhysicalMemory / 100UL * 80UL / 1024UL); } createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); result = true; string parent = string.Format("{0}/{1}", text, text2); ListDictionary childVirtualDirectories = this.ChildVirtualDirectories; if (childVirtualDirectories != null) { foreach (object obj in childVirtualDirectories.Keys) { string text3 = (string)obj; CreateVirtualDirectory createVirtualDirectory2 = new CreateVirtualDirectory(); createVirtualDirectory2.Name = text3; createVirtualDirectory2.Parent = parent; createVirtualDirectory2.CustomizedVDirProperties = (ICollection)childVirtualDirectories[text3]; createVirtualDirectory2.LocalPath = (string)IisUtility.GetIisPropertyValue("Path", (ICollection)childVirtualDirectories[text3]); createVirtualDirectory2.Initialize(); createVirtualDirectory2.Execute(); } } return(result); }
private void CreatePartnerVDir(string parent) { ArrayList arrayList = new ArrayList(); arrayList.Add(new MetabaseProperty("AuthFlags", MetabasePropertyTypes.AuthFlags.NoneSet)); arrayList.Add(new MetabaseProperty("AccessSSLFlags", MetabasePropertyTypes.AccessSSLFlags.AccessSSL | MetabasePropertyTypes.AccessSSLFlags.AccessSSLNegotiateCert | MetabasePropertyTypes.AccessSSLFlags.AccessSSLRequireCert | MetabasePropertyTypes.AccessSSLFlags.AccessSSL128)); arrayList.Add(new MetabaseProperty("AccessFlags", MetabasePropertyTypes.AccessFlags.Read | MetabasePropertyTypes.AccessFlags.Script)); CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = "partner"; createVirtualDirectory.Parent = parent; createVirtualDirectory.CustomizedVDirProperties = arrayList; createVirtualDirectory.LocalPath = null; createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); }
private void CreateReportingWebServiceVDir(string metabasePath, string physicalPath, List <MetabaseProperty> metabaseProperties) { TaskLogger.LogEnter(); CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = "ReportingWebService"; createVirtualDirectory.Parent = metabasePath; createVirtualDirectory.LocalPath = physicalPath; createVirtualDirectory.CustomizedVDirProperties = metabaseProperties; createVirtualDirectory.ApplicationPool = "MSExchangeReportingWebServiceAppPool"; createVirtualDirectory.AppPoolIdentityType = MetabasePropertyTypes.AppPoolIdentityType.LocalSystem; createVirtualDirectory.AppPoolManagedPipelineMode = MetabasePropertyTypes.ManagedPipelineMode.Integrated; createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = "Reporting"; createVirtualDirectory.Parent = "IIS://localhost/W3SVC/1/Root"; createVirtualDirectory.LocalPath = Path.Combine(ConfigurationContext.Setup.InstallPath, "ClientAccess\\Reporting"); createVirtualDirectory.CustomizedVDirProperties = new List <MetabaseProperty> { new MetabaseProperty("AuthFlags", MetabasePropertyTypes.AuthFlags.Anonymous), new MetabaseProperty("AccessSSLFlags", MetabasePropertyTypes.AccessSSLFlags.AccessSSL | MetabasePropertyTypes.AccessSSLFlags.AccessSSLNegotiateCert | MetabasePropertyTypes.AccessSSLFlags.AccessSSL128), new MetabaseProperty("AccessFlags", MetabasePropertyTypes.AccessFlags.Read | MetabasePropertyTypes.AccessFlags.Script) }; createVirtualDirectory.ApplicationPool = "MSExchangeReportingAppPool"; createVirtualDirectory.AppPoolIdentityType = MetabasePropertyTypes.AppPoolIdentityType.LocalSystem; createVirtualDirectory.AppPoolManagedPipelineMode = MetabasePropertyTypes.ManagedPipelineMode.Integrated; createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); base.InternalProcessRecord(); ServerIdParameter serverIdParameter = new ServerIdParameter(); Server server = (Server)base.GetDataObject <Server>(serverIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))); if (!server.IsClientAccessServer && !server.IsCafeServer) { base.ThrowTerminatingError(server.GetServerRoleError(ServerRole.ClientAccess), ErrorCategory.InvalidOperation, server); } using (ServerManager serverManager = new ServerManager()) { ApplicationPool applicationPool = serverManager.ApplicationPools["MSExchangeOWAAppPool"]; if (applicationPool == null) { base.ThrowTerminatingError(new ADNoSuchObjectException(Strings.ErrorOWAVdirAppPoolNotExist), ErrorCategory.ObjectNotFound, serverManager.ApplicationPools); } applicationPool.ManagedPipelineMode = 0; serverManager.CommitChanges(); } QueryFilter filter = new ComparisonFilter(ComparisonOperator.NotEqual, ADOwaVirtualDirectorySchema.OwaVersion, OwaVersions.Exchange2003or2000); base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(base.DataSession, typeof(ADOwaVirtualDirectory), filter, server.Identity, true)); IConfigDataProvider dataSession = base.DataSession; IEnumerable <ADOwaVirtualDirectory> enumerable = dataSession.FindPaged <ADOwaVirtualDirectory>(filter, server.Identity, true, null, 0); foreach (ADOwaVirtualDirectory adowaVirtualDirectory in enumerable) { if (adowaVirtualDirectory.WebSite.Equals("Exchange Back End", StringComparison.OrdinalIgnoreCase)) { string metabasePath = adowaVirtualDirectory.MetabasePath; try { base.WriteVerbose(Strings.VerboseConnectingIISVDir(metabasePath)); using (IisUtility.CreateIISDirectoryEntry(metabasePath)) { if (!DirectoryEntry.Exists(metabasePath)) { this.WriteWarning(Strings.OwaAdOrphanFound(adowaVirtualDirectory.Identity.ToString())); continue; } if (!IisUtility.WebDirObjectExists(metabasePath, this.owaVersion)) { base.WriteVerbose(Strings.VerboseCreatingChildVDir(this.owaVersion, metabasePath)); CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = this.owaVersion; createVirtualDirectory.Parent = metabasePath; createVirtualDirectory.CustomizedVDirProperties = OwaVirtualDirectoryHelper.GetVersionVDirProperties(); createVirtualDirectory.LocalPath = (string)IisUtility.GetIisPropertyValue("Path", createVirtualDirectory.CustomizedVDirProperties); createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); } } OwaVirtualDirectoryHelper.CreateLegacyVDirs(metabasePath, true); OwaVirtualDirectoryHelper.CreateOwaCalendarVDir(metabasePath, VirtualDirectoryRole.Mailbox); if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(adowaVirtualDirectory)) { WebAppVirtualDirectoryHelper.UpdateMetabase(adowaVirtualDirectory, metabasePath, true); } } catch (COMException ex) { base.WriteError(new IISGeneralCOMException(ex.Message, ex.ErrorCode, ex), ErrorCategory.InvalidOperation, null); } if (adowaVirtualDirectory.ExchangeVersion.IsOlderThan(adowaVirtualDirectory.MaximumSupportedExchangeObjectVersion)) { try { adowaVirtualDirectory.SetExchangeVersion(adowaVirtualDirectory.MaximumSupportedExchangeObjectVersion); base.DataSession.Save(adowaVirtualDirectory); } catch (DataSourceTransientException exception) { base.WriteError(exception, ErrorCategory.WriteError, null); } } } } TaskLogger.LogExit(); }
public static VirtualDirectory AddSystemDirectory(string name, Guid diskId) { var cmd = CreateVirtualDirectory.GetSystem(name, diskId); return(cmd.Execute()); }
/// <summary> /// 添加一个普通目录 /// </summary> /// <param name="name">目录名称</param> /// <param name="diskId">所属磁盘编号</param> /// <param name="parentId">父编号,可以为空,如果为空,就是磁盘的根目录下的子目录</param> /// <returns></returns> public static VirtualDirectory AddCommonDirectory(string name, Guid diskId, Guid parentId) { var cmd = CreateVirtualDirectory.GetCommon(name, diskId, parentId); return(cmd.Execute()); }