public static string GetLocalMachineAccount() { // Gets the NetBIOS name of this local computer string computerName = Environment.MachineName; string domainName = GetPrimaryDnsDomainName(computerName); if (String.IsNullOrEmpty(domainName)) { domainName = DnsHelper.GetDomainName(GetLocalMachineFullyQualifiedName(), DnsParseOption.AllowDotlessName); } return(String.Format("{0}\\{1}$", domainName, computerName)); }
public static string GetServiceAccount() { string userAccountName = null; if (SetupInputs.Instance.FindItem(SetupInputTags.CmpServiceLocalAccountTag)) { userAccountName = DnsHelper.GetLocalMachineAccount(); } else { userAccountName = GetVmmServiceDomainAccount(); } return(userAccountName); }
/// <summary> /// Gets the computer name from either FQDN or NetBIOS(no-op). Note that the computer name /// part of the FQDN is not always the same as the NetBIOS name, particularly if the computer /// name is longer than 15 characters (the limit for NetBIOS names). /// </summary> /// <param name="name">The FQDN or NetBIOS name.</param> /// <returns>The extracted computer name.</returns> public static string GetComputerNameFromFqdnOrNetBios(string name) { return(DnsHelper.GetComputerName(name, DnsParseOption.AllowDotlessName)); }