/// <summary> /// Default Constructor /// </summary> /// <param name="SyncFailoverGroupKey"></param> /// <param name="PartitionName"></param> public Partition(string SyncFailoverGroupKey, string PartitionName) { // Create Partition Management Pack Class ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Partition); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = PartitionName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = SyncFailoverGroupKey; // Create Properties of Partition ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; }
/// <summary> /// Default Constructor /// </summary> /// <param name="dg"></param> /// <param name="FullName"></param> /// <param name="Description"></param> /// <param name="Port"></param> /// <param name="MonitorRule"></param> public PoolMember(SyncFailoverGroup dg, string PartitionName, string PoolFullName, string FullName, string Description, string Port, string MonitorRule) { // Get ShortName string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); // Get Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create Pool Management Pack Class ManagementPackClass mpc_PoolMember = SCOM.GetManagementPackClass("AP.F5.LTM.PoolMember"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_PoolMember); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Create Pool Management Pack Class ManagementPackClass mpc_Pool = SCOM.GetManagementPackClass("AP.F5.LTM.Pool"); ManagementPackProperty mpp_PoolKey = mpc_Pool.PropertyCollection["FullName"]; SCOM_Object[mpp_PoolKey].Value = PoolFullName; // Create PoolMember Management Pack Class & Properties ManagementPackProperty mpp_PoolMemberFullName = mpc_PoolMember.PropertyCollection["FullName"]; SCOM_Object[mpp_PoolMemberFullName].Value = FullName; ManagementPackProperty mpp_PoolMemberName = mpc_PoolMember.PropertyCollection["Name"]; SCOM_Object[mpp_PoolMemberName].Value = ShortName; ManagementPackProperty mpp_PoolMemberPartition = mpc_PoolMember.PropertyCollection["Partition"]; SCOM_Object[mpp_PoolMemberPartition].Value = Partition; ManagementPackProperty mpp_PoolMemberPort = mpc_PoolMember.PropertyCollection["Port"]; SCOM_Object[mpp_PoolMemberPort].Value = Port; ManagementPackProperty mpp_PoolMemberDescription = mpc_PoolMember.PropertyCollection["Description"]; SCOM_Object[mpp_PoolMemberDescription].Value = Description; ManagementPackProperty mpp_PoolMemberMonitorRule = mpc_PoolMember.PropertyCollection["MonitorRule"]; SCOM_Object[mpp_PoolMemberMonitorRule].Value = MonitorRule; ManagementPackProperty mpp_PoolMemberPoolName = mpc_PoolMember.PropertyCollection["PoolName"]; SCOM_Object[mpp_PoolMemberPoolName].Value = PoolFullName; }
/// <summary> /// Create SCOM Object /// </summary> public void CreateDeviceGroupScomObject() { // Create Root Entity Class & Display Name Prop ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; // Create Correct Group Management Pack Class ManagementPackClass mpc_DeviceGroup; if (Type == "Sync-Failover") { mpc_DeviceGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); } else { mpc_DeviceGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncOnlyGroup"); } // Create Sync-Failover Group Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_DeviceGroup); // Display Name of Parent (KEY Property) SCOM_Object[mpp_EntityDisplayName].Value = Name; // Set Properties of Device Group // Name (Key Property) ManagementPackProperty mpp_Name = mpc_DeviceGroup.PropertyCollection["Name"]; SCOM_Object[mpp_Name].Value = Name; // Key ManagementPackProperty mpp_Key = mpc_DeviceGroup.PropertyCollection["Key"]; SCOM_Object[mpp_Key].Value = Key; // Standalone ManagementPackProperty mpp_Standalone = mpc_DeviceGroup.PropertyCollection["Standalone"]; SCOM_Object[mpp_Standalone].Value = Standalone; // Devices ManagementPackProperty mpp_Devices = mpc_DeviceGroup.PropertyCollection["Devices"]; SCOM_Object[mpp_Devices].Value = Devices; // Monitor Address ManagementPackProperty mpp_MonitorAddress = mpc_DeviceGroup.PropertyCollection["Addresses"]; SCOM_Object[mpp_MonitorAddress].Value = Addresses; // Monitor Port ManagementPackProperty mpp_MonitorPort = mpc_DeviceGroup.PropertyCollection["Ports"]; SCOM_Object[mpp_MonitorPort].Value = Ports; // Monitor Community ManagementPackProperty mpp_MonitorCommunity = mpc_DeviceGroup.PropertyCollection["Communities"]; SCOM_Object[mpp_MonitorCommunity].Value = Communities; }
/// <summary> /// Default Constructor /// </summary> /// <param name="FullName"></param> /// <param name="Description"></param> /// <param name="MonitorRule"></param> /// <param name="TotalMembers"></param> /// <param name="ActiveMembers"></param> public Pool(SyncFailoverGroup dg, string PartitionName, string FullName, string ShortName, string Description, string MonitorRule, long TotalMembers, long ActiveMembers) { // Set Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create Pool Management Pack Class ManagementPackClass mpc_Pool = SCOM.GetManagementPackClass("AP.F5.LTM.Pool"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Pool); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Create Properties of Pool ManagementPackProperty mpp_PoolFullName = mpc_Pool.PropertyCollection["FullName"]; SCOM_Object[mpp_PoolFullName].Value = FullName; ManagementPackProperty mpp_PoolName = mpc_Pool.PropertyCollection["Name"]; SCOM_Object[mpp_PoolName].Value = ShortName; ManagementPackProperty mpp_PoolPartition = mpc_Pool.PropertyCollection["Partition"]; SCOM_Object[mpp_PoolPartition].Value = Partition; ManagementPackProperty mpp_PoolTotalMembers = mpc_Pool.PropertyCollection["TotalMembers"]; SCOM_Object[mpp_PoolTotalMembers].Value = TotalMembers; ManagementPackProperty mpp_PoolActiveMembers = mpc_Pool.PropertyCollection["ActiveMembers"]; SCOM_Object[mpp_PoolActiveMembers].Value = ActiveMembers; ManagementPackProperty mpp_PoolDescription = mpc_Pool.PropertyCollection["Description"]; SCOM_Object[mpp_PoolDescription].Value = Description; ManagementPackProperty mpp_PoolMonitorRule = mpc_Pool.PropertyCollection["MonitorRule"]; SCOM_Object[mpp_PoolMonitorRule].Value = MonitorRule; }
/// <summary> /// Default Constructor /// </summary> /// <param name="dg"></param> /// <param name="FullName"></param> /// <param name="Description"></param> /// <param name="CertFileName"></param> public ProfileServerSSL(SyncFailoverGroup dg, string PartitionName, string FullName, string Description, string CertFileNames) { // Get ShortName string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); // Get Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create Profile Management Pack Class ManagementPackClass mpc_Profile = SCOM.GetManagementPackClass("AP.F5.LTM.ProfileServerSSL"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Profile); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Now We Can Create Profile Properties ManagementPackProperty mpp_ProfileName = mpc_Profile.PropertyCollection["Name"]; SCOM_Object[mpp_ProfileName].Value = ShortName; ManagementPackProperty mpp_ProfileFullName = mpc_Profile.PropertyCollection["FullName"]; SCOM_Object[mpp_ProfileFullName].Value = FullName; ManagementPackProperty mpp_ProfilePartition = mpc_Profile.PropertyCollection["Partition"]; SCOM_Object[mpp_ProfilePartition].Value = Partition; ManagementPackProperty mpp_ProfileDeviceGroup = mpc_Profile.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_ProfileDeviceGroup].Value = dg.Name; ManagementPackProperty mpp_ProfileDescription = mpc_Profile.PropertyCollection["Description"]; SCOM_Object[mpp_ProfileDescription].Value = Description; ManagementPackProperty mpp_ProfileCertFileName = mpc_Profile.PropertyCollection["CertFileNames"]; SCOM_Object[mpp_ProfileCertFileName].Value = CertFileNames; }
public Node(string SyncFailoverGroupKey, string PartitionName, string NodeFullName, string NodeShortName, string Address, string Description, string MonitorRules) { // Set Partition string Partition = NodeFullName.Substring(1, NodeFullName.LastIndexOf("/") - 1); // Create Node Management Pack Class ManagementPackClass mpc_Node = SCOM.GetManagementPackClass("AP.F5.LTM.Node"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Node); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = NodeShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = SyncFailoverGroupKey; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Set Node Properties // Create our Virtual Server Properties ManagementPackProperty mpp_Name = mpc_Node.PropertyCollection["Name"]; SCOM_Object[mpp_Name].Value = NodeShortName; ManagementPackProperty mpp_FullName = mpc_Node.PropertyCollection["FullName"]; SCOM_Object[mpp_FullName].Value = NodeFullName; ManagementPackProperty mpp_Description = mpc_Node.PropertyCollection["Description"]; SCOM_Object[mpp_Description].Value = Description; ManagementPackProperty mpp_Address = mpc_Node.PropertyCollection["Address"]; SCOM_Object[mpp_Address].Value = Address; ManagementPackProperty mpp_Partition = mpc_Node.PropertyCollection["Partition"]; SCOM_Object[mpp_Partition].Value = Partition; ManagementPackProperty mpp_MonitorRule = mpc_Node.PropertyCollection["MonitorRules"]; SCOM_Object[mpp_MonitorRule].Value = MonitorRules; }
/// <summary> /// Public Constructor /// </summary> public SCOM_Devices() { // Get All Devices ManagementPackClass mpc_Devices = SCOM.GetManagementPackClass("AP.F5.Device"); IObjectReader <EnterpriseManagementObject> DeviceReader; //List<Guid> DevicesGuidList; DeviceReader = SCOM.m_managementGroup.EntityObjects.GetObjectReader <EnterpriseManagementObject>(mpc_Devices, ObjectQueryOptions.Default); foreach (EnterpriseManagementObject dev in DeviceReader) { Items.Add(dev); } }
/// <summary> /// Default Constructor /// </summary> /// <param name="dg">Hosting Device Group</param> /// <param name="Name">name of Traffic Group</param> public void CreateScomObject() { // Create Traffic Group Management Pack Class ManagementPackClass mpc_Trafficgroup = SCOM.GetManagementPackClass("AP.F5.LTM.TrafficGroup"); // Create Traffic Group Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Trafficgroup); // Create Root Entity Class & Display Name Prop ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = Name; // Add in Key Property of Hosting DeviceGroup ManagementPackClass mpc_DeviceGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_DeviceGroup.PropertyCollection["Key"]; // Set parent Cluster Property SCOM_Object[mpp_SyncFailoverGroupKey].Value = DeviceGroup.Key; // Key (Key Property) ManagementPackProperty mpp_TrafficGroupKey = mpc_Trafficgroup.PropertyCollection["Key"]; SCOM_Object[mpp_TrafficGroupKey].Value = Key; // Name ManagementPackProperty mpp_TrafficGroupName = mpc_Trafficgroup.PropertyCollection["Name"]; SCOM_Object[mpp_TrafficGroupName].Value = Name; // FullName ManagementPackProperty mpp_TrafficGroupFullName = mpc_Trafficgroup.PropertyCollection["FullName"]; SCOM_Object[mpp_TrafficGroupFullName].Value = FullName; // Devices ManagementPackProperty mpp_TrafficGroupDevices = mpc_Trafficgroup.PropertyCollection["Devices"]; SCOM_Object[mpp_TrafficGroupDevices].Value = Devices; // DeviceGroup ManagementPackProperty mpp_TrafficGroupDeviceGroup = mpc_Trafficgroup.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_TrafficGroupDeviceGroup].Value = DeviceGroup.Name; }
/// <summary> /// Get Basic Device Info /// </summary> private static void GetDevices() { // Get All Devices from SCOM ManagementPackClass mpc_Devices = SCOM.GetManagementPackClass("AP.F5.Device"); IObjectReader <EnterpriseManagementObject> DeviceReader; //List<Guid> DevicesGuidList; DeviceReader = SCOM.m_managementGroup.EntityObjects.GetObjectReader <EnterpriseManagementObject>(mpc_Devices, ObjectQueryOptions.Default); // Load In CSV File CsvReader csv = new CsvReader(new StreamReader(m_deviceFileName), true); while (csv.ReadNextRecord()) { f5Device newDevice = new f5Device(csv[CSV_ADDRESS], csv[CSV_COMMUNITY], Convert.ToInt32(csv[CSV_PORT]), csv[CSV_F5USER], csv[CSV_F5PASSWORD]); // Loop Through SCOM Objects foreach (EnterpriseManagementObject scom_dev in DeviceReader) { if (scom_dev.DisplayName.ToLower() == newDevice.SystemNodeName.ToLower()) { newDevice.SCOM_DeviceObject = scom_dev; break; } } // Check and Make Sure there's a corresponding SCOM Object if (newDevice.SCOM_DeviceObject != null) { // Add Device to DeviceList DeviceList.Add(newDevice); } else { log.Warn("Could not Find " + newDevice.SystemNodeName + " in SCOM, skipping this device!"); } } // Dispose of CSV File csv.Dispose(); }
/// <summary> /// Default Constructor /// </summary> /// <param name="FullName"></param> /// <param name="Address"></param> /// <param name="Port"></param> /// <param name="Description"></param> /// <param name="Type"></param> /// <param name="DefaultPool"></param> /// <param name="DeviceGroup"></param> /// <param name="ConnectionLimit"></param> /// <param name="ClientSslProfiles"></param> /// <param name="ServerSslProfiles"></param> public VirtualServer(SyncFailoverGroup dg, string PartitionName, string FullName, string Address, string Port, string Description, string Type, string DefaultPool, string ConnectionLimit, string ClientSslProfiles, string ServerSslProfiles) { // Set Default Pool DefaultPoolName = DefaultPool; // Set ShortName string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); // Set Partition string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Create VirtualServer Management Pack Class ManagementPackClass mpc_VirtualServer = SCOM.GetManagementPackClass("AP.F5.LTM.VirtualServer"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_VirtualServer); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Create our Virtual Server Properties ManagementPackProperty mpp_Name = mpc_VirtualServer.PropertyCollection["Name"]; SCOM_Object[mpp_Name].Value = ShortName; ManagementPackProperty mpp_FullName = mpc_VirtualServer.PropertyCollection["FullName"]; SCOM_Object[mpp_FullName].Value = FullName; ManagementPackProperty mpp_Description = mpc_VirtualServer.PropertyCollection["Description"]; SCOM_Object[mpp_Description].Value = Description; ManagementPackProperty mpp_Address = mpc_VirtualServer.PropertyCollection["Address"]; SCOM_Object[mpp_Address].Value = Address; ManagementPackProperty mpp_Port = mpc_VirtualServer.PropertyCollection["Port"]; SCOM_Object[mpp_Port].Value = Port; ManagementPackProperty mpp_Type = mpc_VirtualServer.PropertyCollection["Type"]; SCOM_Object[mpp_Type].Value = Type; ManagementPackProperty mpp_Partition = mpc_VirtualServer.PropertyCollection["Partition"]; SCOM_Object[mpp_Partition].Value = Partition; ManagementPackProperty mpp_DefaultPool = mpc_VirtualServer.PropertyCollection["DefaultPool"]; SCOM_Object[mpp_DefaultPool].Value = DefaultPool; ManagementPackProperty mpp_DeviceGroup = mpc_VirtualServer.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_DeviceGroup].Value = dg.Name; ManagementPackProperty mpp_ConnectionLimit = mpc_VirtualServer.PropertyCollection["ConnectionLimit"]; SCOM_Object[mpp_ConnectionLimit].Value = ConnectionLimit; ManagementPackProperty mpp_ProfileClientSSL = mpc_VirtualServer.PropertyCollection["ProfileClientSSL"]; SCOM_Object[mpp_ProfileClientSSL].Value = ClientSslProfiles; ManagementPackProperty mpp_ProfileServerSSL = mpc_VirtualServer.PropertyCollection["ProfileServerSSL"]; SCOM_Object[mpp_ProfileServerSSL].Value = ServerSslProfiles; }
// Default Constructor public Certificate(ManagementKeyCertificateCertificateInformation_v2 certInfo, SyncFailoverGroup dg, string PartitionName) { string FullName = certInfo.certificate.cert_info.id; string ShortName = FullName.Substring(FullName.LastIndexOf("/") + 1); string Partition = FullName.Substring(1, FullName.LastIndexOf("/") - 1); // Get Type string CertType = ""; switch (certInfo.certificate.cert_type) { case ManagementKeyCertificateCertificateType.CTYPE_CA_SIGNED_YES: CertType = "Certificate Signed by CA"; break; case ManagementKeyCertificateCertificateType.CTYPE_CA_SIGNED_NO: CertType = "Certificate NOT Signed by CA"; break; default: CertType = "Unknown"; break; } // Get Key Type string KeyType = ""; switch (certInfo.certificate.key_type) { case ManagementKeyCertificateKeyType.KTYPE_RSA_PRIVATE: KeyType = "RSA Private Key"; break; case ManagementKeyCertificateKeyType.KTYPE_RSA_PUBLIC: KeyType = "RSA Public Key"; break; case ManagementKeyCertificateKeyType.KTYPE_DSA_PRIVATE: KeyType = "DSA Private Key"; break; case ManagementKeyCertificateKeyType.KTYPE_DSA_PUBLIC: KeyType = "DSA Public Key"; break; case ManagementKeyCertificateKeyType.KTYPE_EC_PRIVATE: KeyType = "EC Private Key"; break; case ManagementKeyCertificateKeyType.KTYPE_EC_PUBLIC: KeyType = "EC Public Key"; break; default: KeyType = "Unknown"; break; } // Get Expiration in Days DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime certExpiry = epoch.AddSeconds(certInfo.certificate.expiration_date); int ExpirationDays = (certExpiry - DateTime.Now).Days; // Create Certificate Management Pack Class ManagementPackClass mpc_Certificate = SCOM.GetManagementPackClass("AP.F5.LTM.Certificate"); // Create New NetworkInterface Object SCOM_Object = new CreatableEnterpriseManagementObject(SCOM.m_managementGroup, mpc_Certificate); // Create Root Entity Class & Key Property ManagementPackClass mpc_Entity = SCOM.GetManagementPackClass("System.Entity"); ManagementPackProperty mpp_EntityDisplayName = mpc_Entity.PropertyCollection["DisplayName"]; SCOM_Object[mpp_EntityDisplayName].Value = ShortName; // Create SyncFailoverGroup Management Pack Class & Key Property ManagementPackClass mpc_SyncFailoverGroup = SCOM.GetManagementPackClass("AP.F5.LTM.SyncFailoverGroup"); ManagementPackProperty mpp_SyncFailoverGroupKey = mpc_SyncFailoverGroup.PropertyCollection["Key"]; SCOM_Object[mpp_SyncFailoverGroupKey].Value = dg.Key; // Create Partition Management Pack Class & Key Property ManagementPackClass mpc_Partition = SCOM.GetManagementPackClass("AP.F5.LTM.Partition"); ManagementPackProperty mpp_PartitionName = mpc_Partition.PropertyCollection["Name"]; SCOM_Object[mpp_PartitionName].Value = PartitionName; // Set Properties of Certificate // FullName (Key Property) ManagementPackProperty mpp_CertificateFullName = mpc_Certificate.PropertyCollection["FullName"]; SCOM_Object[mpp_CertificateFullName].Value = FullName; ManagementPackProperty mpp_CertificateName = mpc_Certificate.PropertyCollection["Name"]; SCOM_Object[mpp_CertificateName].Value = ShortName; ManagementPackProperty mpp_CertificateEmail = mpc_Certificate.PropertyCollection["eMail"]; SCOM_Object[mpp_CertificateEmail].Value = certInfo.certificate.cert_info.email; ManagementPackProperty mpp_CertificateFileName = mpc_Certificate.PropertyCollection["FileName"]; SCOM_Object[mpp_CertificateFileName].Value = certInfo.file_name; ManagementPackProperty mpp_CertificateCertType = mpc_Certificate.PropertyCollection["CertType"]; SCOM_Object[mpp_CertificateCertType].Value = CertType; ManagementPackProperty mpp_CertificateKeyType = mpc_Certificate.PropertyCollection["KeyType"]; SCOM_Object[mpp_CertificateKeyType].Value = KeyType; ManagementPackProperty mpp_CertificateBitLength = mpc_Certificate.PropertyCollection["BitLength"]; SCOM_Object[mpp_CertificateBitLength].Value = certInfo.certificate.bit_length; ManagementPackProperty mpp_CertificateVersion = mpc_Certificate.PropertyCollection["Version"]; SCOM_Object[mpp_CertificateVersion].Value = certInfo.certificate.version; ManagementPackProperty mpp_CertificateSerialNumber = mpc_Certificate.PropertyCollection["SerialNumber"]; SCOM_Object[mpp_CertificateSerialNumber].Value = certInfo.certificate.serial_number; ManagementPackProperty mpp_CertificateExpirationDate = mpc_Certificate.PropertyCollection["ExpirationDate"]; SCOM_Object[mpp_CertificateExpirationDate].Value = certInfo.certificate.expiration_string; ManagementPackProperty mpp_CertificateExpirationDays = mpc_Certificate.PropertyCollection["ExpirationDays"]; SCOM_Object[mpp_CertificateExpirationDays].Value = ExpirationDays; ManagementPackProperty mpp_CertificateDeviceGroup = mpc_Certificate.PropertyCollection["DeviceGroup"]; SCOM_Object[mpp_CertificateDeviceGroup].Value = dg.Name; ManagementPackProperty mpp_CertificatePartition = mpc_Certificate.PropertyCollection["Partition"]; SCOM_Object[mpp_CertificatePartition].Value = Partition; // Get Issuer Info ManagementPackProperty mpp_CertificateIssuerCommon = mpc_Certificate.PropertyCollection["IssuerCommonName"]; SCOM_Object[mpp_CertificateIssuerCommon].Value = certInfo.certificate.issuer.common_name; ManagementPackProperty mpp_CertificateIssuerCountry = mpc_Certificate.PropertyCollection["IssuerCountryName"]; SCOM_Object[mpp_CertificateIssuerCountry].Value = certInfo.certificate.issuer.country_name; ManagementPackProperty mpp_CertificateIssuerDivision = mpc_Certificate.PropertyCollection["IssuerDivisionName"]; SCOM_Object[mpp_CertificateIssuerDivision].Value = certInfo.certificate.issuer.division_name; ManagementPackProperty mpp_CertificateIssuerLocality = mpc_Certificate.PropertyCollection["IssuerLocalityName"]; SCOM_Object[mpp_CertificateIssuerLocality].Value = certInfo.certificate.issuer.locality_name; ManagementPackProperty mpp_CertificateIssuerOrganisation = mpc_Certificate.PropertyCollection["IssuerOrganisationName"]; SCOM_Object[mpp_CertificateIssuerOrganisation].Value = certInfo.certificate.issuer.organization_name; ManagementPackProperty mpp_CertificateIssuerState = mpc_Certificate.PropertyCollection["IssuerStateName"]; SCOM_Object[mpp_CertificateIssuerState].Value = certInfo.certificate.issuer.state_name; // Get Subject Info ManagementPackProperty mpp_CertificateSubjectCommon = mpc_Certificate.PropertyCollection["SubjectCommonName"]; SCOM_Object[mpp_CertificateSubjectCommon].Value = certInfo.certificate.subject.common_name; ManagementPackProperty mpp_CertificateSubjectCountry = mpc_Certificate.PropertyCollection["SubjectCountryName"]; SCOM_Object[mpp_CertificateSubjectCountry].Value = certInfo.certificate.subject.country_name; ManagementPackProperty mpp_CertificateSubjectDivision = mpc_Certificate.PropertyCollection["SubjectDivisionName"]; SCOM_Object[mpp_CertificateSubjectDivision].Value = certInfo.certificate.subject.division_name; ManagementPackProperty mpp_CertificateSubjectLocality = mpc_Certificate.PropertyCollection["SubjectLocalityName"]; SCOM_Object[mpp_CertificateSubjectLocality].Value = certInfo.certificate.subject.locality_name; ManagementPackProperty mpp_CertificateSubjectOrganisation = mpc_Certificate.PropertyCollection["SubjectOrganisationName"]; SCOM_Object[mpp_CertificateSubjectOrganisation].Value = certInfo.certificate.subject.organization_name; ManagementPackProperty mpp_CertificateSubjectState = mpc_Certificate.PropertyCollection["SubjectStateName"]; SCOM_Object[mpp_CertificateSubjectState].Value = certInfo.certificate.subject.state_name; }