/// <summary> /// For all MS SQL databases it enumerate all associated paths using VSS data /// </summary> /// <returns>A collection of DBs and paths</returns> public void QueryDBsInfo() { if (!IsMSSQLInstalled) { return; } m_DBs.Clear(); using (var vssBackupComponents = new VssBackupComponents()) { var writerGUIDS = new [] { MSSQLWriterGuid }; try { vssBackupComponents.SetupWriters(writerGUIDS, null); } catch (Exception) { throw new Interface.UserInformationException("Microsoft SQL Server VSS Writer not found - cannot backup SQL databases.", "NoMsSqlVssWriter"); } foreach (var o in vssBackupComponents.ParseWriterMetaData(writerGUIDS)) { m_DBs.Add(new MSSQLDB(o.Name, o.LogicalPath + "\\" + o.Name, o.Paths.ConvertAll(m => m[0].ToString().ToUpperInvariant() + m.Substring(1)) .Distinct(Utility.Utility.ClientFilenameStringComparer) .OrderBy(a => a).ToList())); } } }
/// <summary> /// For all Hyper-V guests it enumerate all associated paths using VSS data /// </summary> /// <returns>A collection of VMs and paths</returns> private static IEnumerable <WriterMetaData> GetAllVMsPathsVSS() { using (var vssBackupComponents = new VssBackupComponents()) { var writerGUIDS = new [] { HyperVWriterGuid }; try { vssBackupComponents.SetupWriters(writerGUIDS, null); } catch (Exception) { throw new Interface.UserInformationException("Microsoft Hyper-V VSS Writer not found - cannot backup Hyper-V machines.", "NoHyperVVssWriter"); } foreach (var o in vssBackupComponents.ParseWriterMetaData(writerGUIDS)) { yield return(o); } } }