tryusing System;
using System.Text;
using System.Runtime.InteropServices;[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Auto)]
[return:MarshalAs(UnmanagedType.Bool)]
public static extern bool GetComputerName(
    StringBuilder lpBuffer,
    [MarshalAs(UnmanagedType.U4)] ref int lpnSize);int re=0;
StringBuilder buf = new StringBuilder("",1024);
int siz=1024;
bool bOK = GetComputerName(buf,ref siz);
Debug.WriteLine(buf.ToString());