The NetServerAdminCommand API runs a command on a server.
Restrictions
This API can be called from DLS and OS/2 workstations, but DLS workstations can issue this call only to a remote LAN Server workstation. Administrator authority is required to call this API.
#include <netcons.h> #include <server.h> NetServerAdminCommand(pszServername, command, pResult, buf, usBuflen, pusBytesReturned, pusBytesAvail); /* 16 bit */ Net32ServerAdminCommand(pszServername, command, pResult, buf, ulBuflen, pulBytesReturned, pulBytesAvail); /* 32 bit */Parameters
See Common Parameter Definitions for descriptions of parameters not defined here.
command
The following table lists the return codes most significant to this API.
(See API Return Codes for a complete
list of return codes.) ┌─────────────────────────────┬───────┬────────────────────────────────────────┐│SYMBOLICCONSTANT
│VALUE│MEANING │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_Success │ 0 │ No errors were encountered. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_ACCESS_DENIED │ 5 │ Administrator privilege is required. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_BAD_NETPATH │ 53 │ The network path cannot be found. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_NETWORK_ACCESS_DENIED │ 65 │ Network access is denied. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_INVALID_NAME │ 123 │ There is an incorrect character or │
│ │ │ incorrectly formed file system name. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_FILENAME_EXCED_RANGE │ 206. │ The file name is longer than 8 charac-
│
│ │ │ ters or the extension is longer than 3 │
│ │ │ characters. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_MORE_DATA │ 234 │ Additional data is available, but the │
│ │ │ buffer is too small. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_NetNotStarted │ 2102 │ The redirector NETWKSTA.200 has not
│
│ │ │ been started. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_RemoteOnly │ 2106 │ This operation is not supported on │
│ │ │ workstations. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ServerNotStarted │ 2114 │ The Server service has not been
│
│ │ │ started. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_NoRoom │ 2119 │ The server is currently out of the │
│ │ │ requested resource. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_BufTooSmall │ 2123 │ The buffer is too small for fixed- │
│ │ │ length data. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InternalError │ 2140 │ An internal error has occurred. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_BadTransactConfig │ 2141 │ The server is not configured for
│
│ │ │ transactions. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InvalidAPI │ 2142 │ The requested API is not supported on
│
│ │ │ the remote server. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ExecFailure │ 2315 │ A failure occurred when executing a
│
│ │ │ remote administration command. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_TmpFile │ 2316 │ A failure occurred when opening a │
│ │ │ remote temporary file. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_TooMuchData │ 2317 │ The data returned from a remote admin-
│
│ │ │ istration command has been truncated │
│ │ │ to 64KB. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InvalidComputer │ 2351 │ The specified computer name is not
│
│ │ │ valid. │
└─────────────────────────────┴───────┴────────────────────────────────────────┘
Other codes could be returned from the following functions:
The NetServerAdminCommand function is a remote form of the C language library system() function.
When run remotely, NetServerAdminCommand sets the environment of the server as follows:
When run locally, NetServerAdminCommand sets the environment of the server as follows:
For information about: