Sets a new NetBIOS name for the local computer. You need to restart your computer for the new computer name to take effect. You must also have administrative privileges.
Program
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace SetComputerName
{
class Program
{
[DllImport("kernel32.dll")]
static extern bool SetComputerName(string lpComputerName);
static void Main(string[] args)
{
bool done = SetComputerName("NEW_NAME");
if (done)
{
Console.WriteLine("Done");
}
Console.ReadKey();
}
}
}
1 comment:
Does not work in Windows 10 [Version 10.0.18362.959]
Post a Comment