get windows machine name c# code example
Example 1: get current computer name C#
System.Environment.MachineName //from a console or WinForms app.
HttpContext.Current.Server.MachineName //from a web app
System.Net.Dns.GetHostName() //to get the FQDN
Example 2: get windows service name cmd
sc queryex type= service state= all | find /i "keyword"