Skip to content

Latest commit

 

History

History
113 lines (76 loc) · 3.74 KB

nf-sysinfoapi-setcomputernamea.md

File metadata and controls

113 lines (76 loc) · 3.74 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:sysinfoapi.SetComputerNameA
SetComputerNameA function (sysinfoapi.h)
Sets a new NetBIOS name for the local computer. The name is stored in the registry and the name change takes effect the next time the user restarts the computer. (ANSI)
SetComputerNameA
sysinfoapi/SetComputerNameA
base\setcomputername.htm
winprog
ff64fde2-d1b5-4211-b8c4-4823a5469e04
12/05/2018
SetComputerName, SetComputerName function, SetComputerNameA, SetComputerNameW, _win32_setcomputername, base.setcomputername, sysinfoapi/SetComputerName, sysinfoapi/SetComputerNameA, sysinfoapi/SetComputerNameW
sysinfoapi.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
SetComputerNameW (Unicode) and SetComputerNameA (ANSI)
Kernel32.lib
Kernel32.dll
Windows
19H1
SetComputerNameA
sysinfoapi/SetComputerNameA
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-Ms-Win-Core-SysInfo-L1-2-3.dll
KernelBase.dll
SetComputerName
SetComputerNameA
SetComputerNameW

SetComputerNameA function

-description

Sets a new NetBIOS name for the local computer. The name is stored in the registry and the name change takes effect the next time the user restarts the computer.

If the local computer is a node in a cluster, SetComputerName sets NetBIOS name of the local computer, not that of the cluster virtual server.

To set the DNS host name or the DNS domain name, call the SetComputerNameEx function.

-parameters

-param lpComputerName [in]

The computer name that will take effect the next time the computer is started. The name must not be longer than MAX_COMPUTERNAME_LENGTH characters.

The standard character set includes letters, numbers, and the following symbols: ! @ # $ % ^ & ' ) ( . - _ { } ~ . If this parameter contains one or more characters that are outside the standard character set, SetComputerName returns ERROR_INVALID_PARAMETER.

-returns

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

-remarks

Applications using this function must have administrator rights.

Note

The sysinfoapi.h header defines SetComputerName as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

Computer Names

GetComputerName

GetComputerNameEx

SetComputerNameEx

System Information Functions