NetServerSetInfo() Program Example
The NetServerSetInfo() function sets a server's operating parameters; it can set them individually or collectively. The information is stored in a way that allows it to remain in effect after the system has been reinitialized. The following code sample demonstrates how to call the NetServerSetInfo() function. The sample calls NetServerSetInfo(), specifying the level parameter as 1005 (required) to set the sv1005_comment member of the SERVER_INFO_1005 structure.
Create a new empty Win32 console application project. Give the project name and change the project location is needed.

Then, add the source file and give it a suitable name.

Then, add the following source code.
#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, netapi32.lib)
#include <stdio.h>
#include <windows.h>
#include <lm.h>
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 1005;
SERVER_INFO_1005 si;
NET_API_STATUS nStatus;
if (argc != 3)
{
fwprintf_s(stderr, LUsage: %s \\\\ServerName Comment\n, argv[0]);
wprintf(LExample: %s \\\\Bigbrosvr \This is a crap server\\n, argv[0]);
exit(1);
}
// Fill in SERVER_INFO_1005 structure member.
si.sv1005_comment = (LPTSTR) argv[2];
// Call the NetServerSetInfo() function, specifying level 1005.
nStatus = NetServerSetInfo(argv[1],dwLevel,(LPBYTE)&si,NULL);
// Display the result of the call.
if (nStatus == NERR_Success)
{
wprintf(LNetServerSetInfo() is OK!\n);
fwprintf_s(stderr, LComment reset\n, argv[2]);
}
else
{
wprintf(LNetServerSetInfo() failed!\n);
fwprintf_s(stderr, LA system error has occurred: %d\n, nStatus);
}
return 0;
}
We are going to set the server description (however, in this case we just test it against the local Win XP Pro SP2). Build and run the project. The following screenshot is a sample output.


Then, verify our previous action.

MSDN Network Management Reference
The following links describe the network management functions and their associated data structures for Win32 programming.