[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
static extern bool SetComputerNameEx(COMPUTER_NAME_FORMAT NameType,
string lpBuffer);
None.
Please add some!
public class renamefull
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
static extern bool SetComputerNameEx(COMPUTER_NAME_FORMAT NameType,
string lpBuffer);
enum COMPUTER_NAME_FORMAT
{
ComputerNameNetBIOS,
ComputerNameDnsHostname,
ComputerNameDnsDomain,
ComputerNameDnsFullyQualified,
ComputerNamePhysicalNetBIOS,
ComputerNamePhysicalDnsHostname,
ComputerNamePhysicalDnsDomain,
ComputerNamePhysicalDnsFullyQualified,
}
//ComputerNamePhysicalDnsHostname used to rename the computer name and netbios name before domain join
public static bool fullrename(string name)
{
try
{
return SetComputerNameEx(COMPUTER_NAME_FORMAT.ComputerNamePhysicalDnsHostname, name);
}
catch (Exception)
{
return false;
}
}
}
Do you know one? Please contribute it!