bin/projects/dbatools/dbatools/Discovery/DbaInstanceReport.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using System;

namespace Sqlcollaborative.Dbatools.Discovery
{
    /// <summary>
    /// The report on a discovered instance
    /// </summary>
    [Serializable]
    public class DbaInstanceReport
    {
        /// <summary>
        /// The computername of the underlying machine. Usually equal to the computername, but may differ in case of clusters
        /// </summary>
        public string MachineName { get; set; }

        /// <summary>
        /// The computername of the target
        /// </summary>
        public string ComputerName { get; set; }

        /// <summary>
        /// The name of the instance
        /// </summary>
        public string InstanceName { get; set; }

        /// <summary>
        /// The full server instance name
        /// </summary>
        public string FullName
        {
            get
            {
                if (!String.IsNullOrEmpty(InstanceName) && !Utility.UtilityHost.IsLike(InstanceName, "MSSQLSERVER"))
                    return String.Format(@"{0}\{1}", ComputerName, InstanceName);
                else if ((Port == 1433) || (Utility.UtilityHost.IsLike(InstanceName, "MSSQLSERVER")))
                    return ComputerName;
                else
                    return String.Format(@"{0}:{1}", ComputerName, Port);
            }
            set { }
        }

        /// <summary>
        /// The full name usable to connect via SMO
        /// </summary>
        public string SqlInstance
        {
            get
            {
                if (!String.IsNullOrEmpty(InstanceName) && !Utility.UtilityHost.IsLike(InstanceName, "MSSQLSERVER"))
                    return String.Format(@"{0}\{1}", ComputerName, InstanceName);
                else if ((Port == 1433) || (Utility.UtilityHost.IsLike(InstanceName, "MSSQLSERVER")))
                    return ComputerName;
                else
                    return String.Format(@"{0},{1}", ComputerName, Port);
            }
            set { }
        }

        /// <summary>
        /// The port number the server listens on
        /// </summary>
        public int Port { get; set; }

        /// <summary>
        /// When the scan was concluded
        /// </summary>
        public DateTime Timestamp;

        /// <summary>
        /// Was a TCP connect successful?
        /// </summary>
        public bool TcpConnected { get; set; }

        /// <summary>
        /// Was a connection via SQL successful (even if we got access denied)
        /// </summary>
        public bool SqlConnected { get; set; }
    
        /// <summary>
        /// The DNS Resolution object
        /// </summary>
        public System.Net.IPHostEntry DnsResolution { get; set; }

        /// <summary>
        /// The ping resolution object
        /// </summary>
        public bool Ping { get; set; }

        /// <summary>
        /// The reply received from the browse request
        /// </summary>
        public DbaBrowserReply BrowseReply { get; set; }

        /// <summary>
        /// The windows services for the instance
        /// </summary>
        public object[] Services { get; set; }

        /// <summary>
        /// The SQL Server services that do not belong to that instance alone
        /// </summary>
        public object[] SystemServices { get; set; }

        /// <summary>
        /// Service Principal Names found
        /// </summary>
        public string[] SPNs { get; set; }

        /// <summary>
        /// The ports that have been scanned
        /// </summary>
        public DbaPortReport[] PortsScanned { get; set; }
    

        /// <summary>
        /// What we know about its availability
        /// </summary>
        public DbaInstanceAvailability Availability { get; set; }

        /// <summary>
        /// How confident we are, that this is a real instance
        /// </summary>
        public DbaInstanceConfidenceLevel Confidence { get; set; }

        /// <summary>
        /// What we used to scan the instance
        /// </summary>
        public DbaInstanceScanType ScanTypes { get; set; }
    }
}