Skip to content

Instantly share code, notes, and snippets.

@indented-automation
Last active June 2, 2022 19:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save indented-automation/4743a559555ff78781fce981d171c90f to your computer and use it in GitHub Desktop.
Save indented-automation/4743a559555ff78781fce981d171c90f to your computer and use it in GitHub Desktop.
function Test-RpcPort {
<#
.SYNOPSIS
Enumerates and tests connectivity to the RPC ports on the target server.
.DESCRIPTION
Enumerates and tests connectivity to the RPC ports on the target server.
Rebuilt from https://gallery.technet.microsoft.com/Test-RPC-Testing-RPC-4396fcda
#>
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline)]
[String[]]
$ComputerName = 'localhost'
)
begin {
Add-Type -TypeDefinition '
using System;
using System.Runtime.InteropServices;
namespace Rpc
{
public enum RpcReturnCode : long
{
TRPC_S_OKBD = 0x00000000, // The requested operation completed successfully.
RPC_S_ACCESS_DENIED = 0x00000005, // Access for making the remote procedure call was denied.
RPC_S_NO_NS_PRIVILEGE = 0x00000005, // There is no privilege for a name-service operation.
RPC_X_SS_CONTEXT_MISMATCH = 0x00000006, // The context handle does not match any known context handles.
RPC_S_OUT_OF_MEMORY = 0x0000000E, // The needed memory is not available.
RPC_X_NO_MEMORY = 0x0000000E, // Insufficient memory is available.
RPC_X_PIPE_APP_MEMORY = 0x0000000E, // Insufficient memory is available for pipe data.
RPC_S_INVALID_ARG = 0x00000057, // The specified argument is not valid.
RPC_S_INVALID_LEVEL = 0x00000057, // The version, level, or flags parameter is invalid.
RPC_S_BUFFER_TOO_SMALL = 0x0000007A, // The buffer given to RPC by the caller is too small.
RPC_S_OUT_OF_THREADS = 0x000000A4, // The RPC run-time library was not able to create another thread.
RPC_S_ASYNC_CALL_PENDING = 0x000003E5, // The asynchronous remote procedure call has not yet completed.
RPC_S_SERVER_OUT_OF_MEMORY = 0x0000046A, // The server has insufficient memory to complete this operation.
RPC_S_UNKNOWN_PRINCIPAL = 0x00000534, // The principal name is not recognized.
RPC_S_INVALID_SECURITY_DESC = 0x0000053A, // The security descriptor is not in the valid format.
RPC_S_INVALID_STRING_BINDING = 0x000006A4, // The string binding is invalid.
RPC_S_WRONG_KIND_OF_BINDING = 0x000006A5, // The binding handle is not the correct type.
RPC_S_INVALID_BINDING = 0x000006A6, // The binding handle is invalid.
RPC_S_PROTSEQ_NOT_SUPPORTED = 0x000006A7, // The RPC protocol sequence is not supported.
RPC_S_INVALID_RPC_PROTSEQ = 0x000006A8, // The RPC protocol sequence is invalid.
RPC_S_INVALID_STRING_UUID = 0x000006A9, // The strings Universally Unique Identifier (UUID) is invalid.
RPC_S_INVALID_ENDPOINT_FORMAT = 0x000006AA, // The endpoint format is invalid.
RPC_S_INVALID_NET_ADDR = 0x000006AB, // The network address is invalid.
RPC_S_NO_ENDPOINT_FOUND = 0x000006AC, // No endpoint has been found.
RPC_S_INVALID_TIMEOUT = 0x000006AD, // The time-out value is invalid.
RPC_S_OBJECT_NOT_FOUND = 0x000006AE, // The object UUID has not been found.
RPC_S_ALREADY_REGISTERED = 0x000006AF, // The objects UUID has already been registered.
RPC_S_TYPE_ALREADY_REGISTERED = 0x000006B0, // The type UUID has already been registered.
RPC_S_ALREADY_LISTENING = 0x000006B1, // The server is already listening.
RPC_S_NO_PROTSEQS_REGISTERED = 0x000006B2, // No protocol sequences have been registered.
RPC_S_NOT_LISTENING = 0x000006B3, // The server is not listening.
RPC_S_UNKNOWN_MGR_TYPE = 0x000006B4, // The manager type is unknown.
RPC_S_UNKNOWN_IF = 0x000006B5, // The interface is unknown.
RPC_S_NO_BINDINGS = 0x000006B6, // There are no bindings.
RPC_S_NO_PROTSEQS = 0x000006B7, // There are no protocol sequences.
RPC_S_CANT_CREATE_ENDPOINT = 0x000006B8, // The endpoint cannot be created.
RPC_S_OUT_OF_RESOURCES = 0x000006B9, // Not enough resources are available to complete this operation.
RPC_S_SERVER_UNAVAILABLE = 0x000006BA, // The server is unavailable.
RPC_S_SERVER_TOO_BUSY = 0x000006BB, // The server is too busy to complete this operation.
RPC_S_INVALID_NETWORK_OPTIONS = 0x000006BC, // The network options are invalid.
RPC_S_NO_CALL_ACTIVE = 0x000006BD, // There is no remote procedure call active in this thread.
RPC_S_CALL_FAILED = 0x000006BE, // The remote procedure call failed. Implies the server was reachable at a certain point in time, and execution of the remote procedure call on the server might have started.
RPC_S_CALL_FAILED_DNE = 0x000006BF, // The remote procedure call failed, and execution on the server did not start. Implies the server was reachable at a certain point in time.
RPC_S_PROTOCOL_ERROR = 0x000006C0, // An RPC protocol error has occurred.
RPC_S_UNSUPPORTED_TRANS_SYN = 0x000006C2, // The transfer syntax is not supported by the server.
RPC_S_UNSUPPORTED_TYPE = 0x000006C4, // The type UUID is not supported.
RPC_S_INVALID_TAG = 0x000006C5, // The discriminant value does not match any of the case values. There is no default case.
RPC_X_INVALID_TAG = 0x000006C5, // The discriminant value does not match any of the case values. There is no default case.
RPC_S_INVALID_BOUND = 0x000006C6, // The array bounds are invalid.
RPC_X_INVALID_BOUND = 0x000006C6, // The specified bounds of an array are inconsistent.
RPC_S_NO_ENTRY_NAME = 0x000006C7, // The binding does not contain an entry name.
RPC_S_INVALID_NAME_SYNTAX = 0x000006C8, // The name syntax is invalid.
RPC_S_UNSUPPORTED_NAME_SYNTAX = 0x000006C9, // The name syntax is not supported.
RPC_S_SERVER_NOT_LISTENING = 0x000006CA, // The server is not listening for remote procedure calls.
RPC_S_UUID_NO_ADDRESS = 0x000006CB, // No network address is available for constructing a UUID.
RPC_S_DUPLICATE_ENDPOINT = 0x000006CC, // The endpoint is a duplicate.
RPC_S_UNKNOWN_AUTHN_TYPE = 0x000006CD, // The authentication type is unknown.
RPC_S_MAX_CALLS_TOO_SMALL = 0x000006CE, // The maximum number of calls is too small.
RPC_S_STRING_TOO_LONG = 0x000006CF, // The string is too long.
RPC_S_PROTSEQ_NOT_FOUND = 0x000006D0, // The RPC protocol sequence has not been found.
RPC_S_PROCNUM_OUT_OF_RANGE = 0x000006D1, // The procedure number is out of range.
RPC_S_BINDING_HAS_NO_AUTH = 0x000006D2, // The binding does not contain any authentication information.
RPC_S_UNKNOWN_AUTHN_SERVICE = 0x000006D3, // The authentication service is unknown.
RPC_S_UNKNOWN_AUTHN_LEVEL = 0x000006D4, // The authentication level is unknown.
RPC_S_INVALID_AUTH_IDENTITY = 0x000006D5, // The specified authentication identity could not be used. For example an LRPC client stopped functioning in the middle of an RPC and the server could not impersonate it. Or, credentials for a client could not be acquired by the security provider.
RPC_S_UNKNOWN_AUTHZ_SERVICE = 0x000006D6, // The authorization service is unknown.
EPT_S_INVALID_ENTRY = 0x000006D7, // General failure when trying to perform an operation on the endpoint mapper database.
EPT_S_NOT_REGISTERED = 0x000006D9, // There are no more endpoints available from the endpoint-map database.
RPC_S_NOTHING_TO_EXPORT = 0x000006DA, // There is nothing to export.
RPC_S_INCOMPLETE_NAME = 0x000006DB, // The entry name is incomplete.
RPC_S_INVALID_VERS_OPTION = 0x000006DC, // The version option is invalid.
RPC_S_NO_MORE_MEMBERS = 0x000006DD, // There are no more members.
RPC_S_NOT_ALL_OBJS_UNEXPORTED = 0x000006DE, // Not all objects are unexported.
RPC_S_INTERFACE_NOT_FOUND = 0x000006DF, // The interface has not been found.
RPC_S_ENTRY_ALREADY_EXISTS = 0x000006E0, // The entry already exists
RPC_S_ENTRY_NOT_FOUND = 0x000006E1, // The entry is not found.
RPC_S_NAME_SERVICE_UNAVAILABLE = 0x000006E2, // The name service is unavailable.
RPC_S_INVALID_NAF_ID = 0x000006E3, // The network-address family is invalid.
RPC_S_CANNOT_SUPPORT = 0x000006E4, // The requested operation is not supported.
RPC_S_NO_CONTEXT_AVAILABLE = 0x000006E5, // No security context is available to allow impersonation.
RPC_S_INTERNAL_ERROR = 0x000006E6, // An internal error has occurred in a remote procedure call.
RPC_S_ZERO_DIVIDE = 0x000006E7, // The server has attempted an integer divide by zero.
RPC_S_ADDRESS_ERROR = 0x000006E8, // An addressing error has occurred on the server.
RPC_S_FP_DIV_ZERO = 0x000006E9, // A floating-point operation at the server has caused a divide by zero.
RPC_S_FP_OVERFLOW = 0x000006EA, // A floating-point overflow has occurred at the server.
RPC_S_FP_UNDERFLOW = 0x000006EB, // A floating-point underflow has occurred at the server.
RPC_X_NO_MORE_ENTRIES = 0x000006EC, // The list of servers available for the [auto_handle] binding has been exhausted.
RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 0x000006ED, // The file designated by DCERPCCHARTRANS cannot be opened.
RPC_X_SS_CHAR_TRANS_SHORT_FILE = 0x000006EE, // The file containing the character-translation table has fewer than 512 bytes.
RPC_X_SS_IN_NULL_CONTEXT = 0x000006EF, // A null context handle is passed in an in parameter position.
RPC_X_SS_CONTEXT_DAMAGED = 0x000006F1, // The context handle changed during a call. Only raised on the client side.
RPC_X_SS_HANDLES_MISMATCH = 0x000006F2, // The binding handles passed to a remote procedure call do not match.
RPC_X_SS_CANNOT_GET_CALL_HANDLE = 0x000006F3, // The stub is unable to get the call handle.
RPC_X_NULL_REF_POINTER = 0x000006F4, // A null reference pointer has been passed to the stub.
RPC_X_ENUM_VALUE_OUT_OF_RANGE = 0x000006F5, // The enumeration value is out of range.
RPC_X_ENUM_VALUE_TOO_LARGE = 0x000006F5, // The enumeration constant must be less than 65535.
RPC_X_BYTE_COUNT_TOO_SMALL = 0x000006F6, // The byte count is too small.
RPC_X_BAD_STUB_DATA = 0x000006F7, // The stub has received bad data.
RPC_X_INVALID_BUFFER = 0x000006F8, // The pointer does not contain the address of a valid data buffer.
RPC_X_SS_INVALID_BUFFER = 0x000006F8, // The buffer is not valid for the operation.
RPC_S_CALL_IN_PROGRESS = 0x000006FF, // A remote procedure call is still in progress.
RPC_S_NO_MORE_BINDINGS = 0x0000070E, // There are no more bindings.
RPC_S_NO_INTERFACES = 0x00000719, // No interfaces are registered.
RPC_S_CALL_CANCELLED = 0x0000071A, // The remote procedure call was canceled, or if a call time-out was specified, the call timed out.
RPC_S_BINDING_INCOMPLETE = 0x0000071B, // Not all required elements from the binding handle were supplied.
RPC_S_COMM_FAILURE = 0x0000071C, // Unable to communicate with the server.
RPC_S_UNSUPPORTED_AUTHN_LEVEL = 0x0000071D, // The authentication level is not supported.
RPC_S_NO_PRINC_NAME = 0x0000071E, // No principal name is registered.
RPC_S_NOT_RPC_ERROR = 0x0000071F, // The status code requested is not valid.
RPC_S_UUID_LOCAL_ONLY = 0x00000720, // A UUID valid only for the local computer has been allocated.
RPC_S_SEC_PKG_ERROR = 0x00000721, // An error that has no RPC mapping was returned by the security package. Retrieve the security provider error using the RPC Extended Error Mechanism.
RPC_S_NOT_CANCELLED = 0x00000722, // The thread is not canceled.
RPC_X_SS_WRONG_ES_VERSION = 0x00000724, // The software version is incorrect.
RPC_X_SS_WRONG_STUB_VERSION = 0x00000725, // The stub version is incorrect.
RPC_X_INVALID_PIPE_OPERATION = 0x00000727, // The requested pipe operation is not supported.
RPC_S_GROUP_MEMBER_NOT_FOUND = 0x0000076A, // The group member has not been found.
EPT_S_CANT_CREATE = 0x0000076B, // An entry into the endpoint mapper database cannot be created.
RPC_S_INVALID_OBJECT = 0x0000076C, // The object is invalid.
NERR_NetNotStarted = 0x00000836, // The workstation driver is not installed.
NERR_UnknownServer = 0x00000837, // The server could not be located.
NERR_ShareMem = 0x00000838, // An internal error occurred. The network cannot access a shared memory segment.
NERR_NoNetworkResource = 0x00000839, // A network resource shortage occurred.
NERR_RemoteOnly = 0x0000083A, // This operation is not supported on workstations.
NERR_DevNotRedirected = 0x0000083B, // The device is not connected.
NERR_ServerNotStarted = 0x00000842, // The Server service is not started.
NERR_ItemNotFound = 0x00000843, // The queue is empty.
NERR_UnknownDevDir = 0x00000844, // The device or directory does not exist.
NERR_RedirectedPath = 0x00000845, // The operation is invalid on a redirected resource.
NERR_DuplicateShare = 0x00000846, // The name has already been shared.
NERR_NoRoom = 0x00000847, // The server is currently out of the requested resource.
NERR_TooManyItems = 0x00000849, // Requested addition of items exceeds the maximum allowed.
NERR_InvalidMaxUsers = 0x0000084A, // The Peer service supports only two simultaneous users.
NERR_BufTooSmall = 0x0000084B, // The API return buffer is too small.
NERR_RemoteErr = 0x0000084F, // A remote API error occurred.
NERR_LanmanIniError = 0x00000853, // An error occurred when opening or reading the configuration file.
NERR_NetworkError = 0x00000858, // A general network error occurred.
NERR_WkstaInconsistentState = 0x00000859, // The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service.
NERR_WkstaNotStarted = 0x0000085A, // The Workstation service has not been started.
NERR_BrowserNotStarted = 0x0000085B, // The requested information is not available.
NERR_InternalError = 0x0000085C, // An internal error occurred.
NERR_BadTransactConfig = 0x0000085D, // The server is not configured for transactions.
NERR_InvalidAPI = 0x0000085E, // The requested API is not supported on the remote server.
NERR_BadEventName = 0x0000085F, // The event name is invalid.
NERR_DupNameReboot = 0x00000860, // The computer name already exists on the network. Change it and restart the computer.
NERR_CfgCompNotFound = 0x00000862, // The specified component could not be found in the configuration information.
NERR_CfgParamNotFound = 0x00000863, // The specified parameter could not be found in the configuration information.
NERR_LineTooLong = 0x00000865, // A line in the configuration file is too long.
NERR_QNotFound = 0x00000866, // The printer does not exist.
NERR_JobNotFound = 0x00000867, // The print job does not exist.
NERR_DestNotFound = 0x00000868, // The printer destination cannot be found.
NERR_DestExists = 0x00000869, // The printer destination already exists.
NERR_QExists = 0x0000086A, // The printer queue already exists.
NERR_QNoRoom = 0x0000086B, // No more printers can be added.
NERR_JobNoRoom = 0x0000086C, // No more print jobs can be added.
NERR_DestNoRoom = 0x0000086D, // No more printer destinations can be added.
NERR_DestIdle = 0x0000086E, // This printer destination is idle and cannot accept control operations.
NERR_DestInvalidOp = 0x0000086F, // This printer destination request contains an invalid control function.
NERR_ProcNoRespond = 0x00000870, // The print processor is not responding.
NERR_SpoolerNotLoaded = 0x00000871, // The spooler is not running.
NERR_DestInvalidState = 0x00000872, // This operation cannot be performed on the print destination in its current state.
NERR_QinvalidState = 0x00000873, // This operation cannot be performed on the printer queue in its current state.
NERR_JobInvalidState = 0x00000874, // This operation cannot be performed on the print job in its current state.
NERR_SpoolNoMemory = 0x00000875, // A spooler memory allocation failure occurred.
NERR_DriverNotFound = 0x00000876, // The device driver does not exist.
NERR_DataTypeInvalid = 0x00000877, // The data type is not supported by the print processor.
NERR_ProcNotFound = 0x00000878, // The print processor is not installed.
NERR_ServiceTableLocked = 0x00000884, // The service database is locked.
NERR_ServiceTableFull = 0x00000885, // The service table is full.
NERR_ServiceInstalled = 0x00000886, // The requested service has already been started.
NERR_ServiceEntryLocked = 0x00000887, // The service does not respond to control actions.
NERR_ServiceNotInstalled = 0x00000888, // The service has not been started.
NERR_BadServiceName = 0x00000889, // The service name is invalid.
NERR_ServiceCtlTimeout = 0x0000088A, // The service is not responding to the control function.
NERR_ServiceCtlBusy = 0x0000088B, // The service control is busy.
NERR_BadServiceProgName = 0x0000088C, // The configuration file contains an invalid service program name.
NERR_ServiceNotCtrl = 0x0000088D, // The service could not be controlled in its present state.
NERR_ServiceKillProc = 0x0000088E, // The service ended abnormally.
NERR_ServiceCtlNotValid = 0x0000088E, // The requested pause or stop is not valid for this service.
NERR_NotInDispatchTbl = 0x00000890, // The service control dispatcher could not find the service name in the dispatch table.
NERR_BadControlRecv = 0x00000891, // The service control dispatcher pipe read failed.
NERR_ServiceNotStarting = 0x00000892, // A thread for the new service could not be created.
NERR_AlreadyLoggedOn = 0x00000898, // This workstation is already logged on to the local area network (LAN).
NERR_NotLoggedOn = 0x00000899, // The workstation is not logged on to the LAN.
NERR_BadUsername = 0x0000089A, // The user name or group name parameter is invalid.
NERR_BadPassword = 0x0000089B, // The password parameter is invalid.
NERR_UnableToAddName_W = 0x0000089C, // @W The logon processor did not add the message alias.
NERR_UnableToAddName_F = 0x0000089D, // The logon processor did not add the message alias.
NERR_UnableToDelName_W = 0x0000089E, // @W The logoff processor did not delete the message alias.
NERR_UnableToDelName_F = 0x0000089F, // The logoff processor did not delete the message alias.
NERR_LogonsPaused = 0x000008A1, // Network logons are paused.
NERR_LogonServerConflict = 0x000008A2, // A centralized logon-server conflict occurred.
NERR_LogonNoUserPath = 0x000008A3, // The server is configured without a valid user path.
NERR_LogonScriptError = 0x000008A4, // An error occurred while loading or running the logon script.
NERR_StandaloneLogon = 0x000008A6, // The logon server was not specified. Your computer will be logged on as STANDALONE.
NERR_LogonServerNotFound = 0x000008A7, // The logon server could not be found.
NERR_LogonDomainExists = 0x000008A8, // There is already a logon domain for this computer.
NERR_NonValidatedLogon = 0x000008A9, // The logon server could not validate the logon.
NERR_ACFNotFound = 0x000008AB, // The security database could not be found.
NERR_GroupNotFound = 0x000008AC, // The group name could not be found.
NERR_UserNotFound = 0x000008AD, // The user name could not be found.
NERR_ResourceNotFound = 0x000008AE, // The resource name could not be found.
NERR_GroupExists = 0x000008AF, // The group already exists.
NERR_UserExists = 0x000008B0, // The user account already exists.
NERR_ResourceExists = 0x000008B1, // The resource permission list already exists.
NERR_NotPrimary = 0x000008B2, // This operation is only allowed on the primary domain controller of the domain.
NERR_ACFNotLoaded = 0x000008B3, // The security database has not been started.
NERR_ACFNoRoom = 0x000008B4, // There are too many names in the user accounts database.
NERR_ACFFileIOFail = 0x000008B5, // A disk I/O failure occurred.
NERR_ACFTooManyLists = 0x000008B6, // The limit of 64 entries per resource was exceeded.
NERR_UserLogon = 0x000008B7, // Deleting a user with a session is not allowed.
NERR_ACFNoParent = 0x000008B8, // The parent directory could not be located.
NERR_CanNotGrowSegment = 0x000008B9, // The security database session cache segment could not be added to.
NERR_SpeGroupOp = 0x000008BA, // This operation is not allowed on this special group.
NERR_NotInCache = 0x000008BB, // This user is not cached in user accounts database session cache.
NERR_UserInGroup = 0x000008BC, // The user already belongs to this group.
NERR_UserNotInGroup = 0x000008BD, // The user does not belong to this group.
NERR_AccountUndefined = 0x000008BE, // This user account is undefined.
NERR_AccountExpired = 0x000008BF, // This user account has expired.
NERR_InvalidWorkstation = 0x000008C0, // The user is not allowed to log on from this workstation.
NERR_InvalidLogonHours = 0x000008C1, // The user is not allowed to log on at this time.
NERR_PasswordExpired = 0x000008C2, // The password of this user has expired.
NERR_PasswordCantChange = 0x000008C3, // The password of this user cannot change.
NERR_PasswordHistConflict = 0x000008C4, // This password cannot be used now.
NERR_PasswordTooShort = 0x000008C5, // The password does not meet the password policy requirements. Check the minimum password length, password complexity, and password history requirements.
NERR_PasswordTooRecent = 0x000008C6, // The password of this user is too recent to change.
NERR_InvalidDatabase = 0x000008C7, // The security database is corrupted.
NERR_DatabaseUpToDate = 0x000008C8, // No updates are necessary to this replicant network/local security database.
NERR_SyncRequired = 0x000008C9, // This replicant database is outdated; synchronization is required.
NERR_UseNotFound = 0x000008CA, // The network connection could not be found.
NERR_BadAsgType = 0x000008CB, // This asg_type is invalid.
NERR_DeviceIsShared = 0x000008CC, // This device is currently being shared.
NERR_NoComputerName = 0x000008DE, // The computer name could not be added as a message alias. The name might already exist on the network.
NERR_MsgAlreadyStarted = 0x000008DF, // The Messenger service is already started.
NERR_MsgInitFailed = 0x000008E0, // The Messenger service failed to start.
NERR_NameNotFound = 0x000008E1, // The message alias could not be found on the network.
NERR_AlreadyForwarded = 0x000008E2, // This message alias has already been forwarded.
NERR_AddForwarded = 0x000008E3, // This message alias has been added but is still forwarded.
NERR_AlreadyExists = 0x000008E4, // This message alias already exists locally.
NERR_TooManyNames = 0x000008E5, // The maximum number of added message aliases has been exceeded.
NERR_DelComputerName = 0x000008E6, // The computer name could not be deleted.
NERR_LocalForward = 0x000008E7, // Messages cannot be forwarded back to the same workstation.
NERR_GrpMsgProcessor = 0x000008E8, // An error occurred in the domain message processor.
NERR_PausedRemote = 0x000008E9, // The message was sent, but the recipient has paused the Messenger service.
NERR_BadReceive = 0x000008EA, // The message was sent but not received.
NERR_NameInUse = 0x000008EB, // The message alias is currently in use. Try again later.
NERR_MsgNotStarted = 0x000008EC, // The Messenger service has not been started.
NERR_NotLocalName = 0x000008ED, // The name is not on the local computer.
NERR_NoForwardName = 0x000008EE, // The forwarded message alias could not be found on the network.
NERR_RemoteFull = 0x000008EF, // The message alias table on the remote station is full.
NERR_NameNotForwarded = 0x000008F0, // Messages for this alias are not currently being forwarded.
NERR_TruncatedBroadcast = 0x000008F1, // The broadcast message was truncated.
NERR_InvalidDevice = 0x000008F6, // This is an invalid device name.
NERR_WriteFault = 0x000008F7, // A write fault occurred.
NERR_DuplicateName = 0x000008F9, // A duplicate message alias exists on the network.
NERR_DeleteLater = 0x000008FA, // @W This message alias will be deleted later.
NERR_IncompleteDel = 0x000008FB, // The message alias was not successfully deleted from all networks.
NERR_MultipleNets = 0x000008FC, // This operation is not supported on computers with multiple networks.
NERR_NetNameNotFound = 0x00000906, // This shared resource does not exist.
NERR_DeviceNotShared = 0x00000907, // This device is not shared.
NERR_ClientNameNotFound = 0x00000908, // A session does not exist with that computer name.
NERR_FileIdNotFound = 0x0000090A, // There is not an open file with that identification number.
NERR_ExecFailure = 0x0000090B, // A failure occurred when executing a remote administration command.
NERR_TmpFile = 0x0000090C, // A failure occurred when opening a remote temporary file.
NERR_TooMuchData = 0x0000090D, // The data returned from a remote administration command has been truncated to 64 KB.
NERR_DeviceShareConflict = 0x0000090E, // This device cannot be shared as both a spooled and a nonspooled resource.
NERR_BrowserTableIncomplete = 0x0000090F, // The information in the list of servers might be incorrect.
NERR_NotLocalDomain = 0x00000910, // The computer is not active in this domain.
NERR_IsDfsShare = 0x00000911, // The share must be removed from the Distributed File System (Dfs) before it can be deleted.
NERR_DevInvalidOpCode = 0x0000091B, // The operation is invalid for this device.
NERR_DevNotFound = 0x0000091C, // This device cannot be shared.
NERR_DevNotOpen = 0x0000091D, // This device was not open.
NERR_BadQueueDevString = 0x0000091E, // This device name list is invalid.
NERR_BadQueuePriority = 0x0000091F, // The queue priority is invalid.
NERR_NoCommDevs = 0x00000921, // There are no shared communication devices.
NERR_QueueNotFound = 0x00000922, // The queue you specified does not exist.
NERR_BadDevString = 0x00000924, // This list of devices is invalid.
NERR_BadDev = 0x00000925, // The requested device is invalid.
NERR_InUseBySpooler = 0x00000926, // This device is already in use by the spooler.
NERR_CommDevInUse = 0x00000927, // This device is already in use as a communication device.
NERR_InvalidComputer = 0x0000092F, // This computer name is invalid.
NERR_MaxLenExceeded = 0x00000932, // The string and prefix specified are too long.
NERR_BadComponent = 0x00000934, // This path component is invalid.
NERR_CantType = 0x00000935, // The type of input could not be determined.
NERR_TooManyEntries = 0x0000093A, // The buffer for types is not big enough.
NERR_ProfileFileTooBig = 0x00000942, // Profile files cannot exceed 64 KB.
NERR_ProfileOffset = 0x00000943, // The start offset is out of range.
NERR_ProfileCleanup = 0x00000944, // The system cannot delete current connections to network resources.
NERR_ProfileUnknownCmd = 0x00000945, // The system was unable to parse the command line in this file.
NERR_ProfileLoadErr = 0x00000946, // An error occurred while loading the profile file.
NERR_ProfileSaveErr = 0x00000947, // @W Errors occurred while saving the profile file. The profile was partially saved.
NERR_LogOverflow = 0x00000949, // Log file %1 is full.
NERR_LogFileChanged = 0x0000094A, // This log file has changed between reads.
NERR_LogFileCorrupt = 0x0000094B, // Log file %1 is corrupt.
NERR_SourceIsDir = 0x0000094C, // The source path cannot be a directory.
NERR_BadSource = 0x0000094D, // The source path is illegal.
NERR_BadDest = 0x0000094E, // The destination path is illegal.
NERR_DifferentServers = 0x0000094F, // The source and destination paths are on different servers.
NERR_RunSrvPaused = 0x00000951, // The Run server you requested is paused.
NERR_ErrCommRunSrv = 0x00000955, // An error occurred when communicating with a Run server.
NERR_ErrorExecingGhost = 0x00000957, // An error occurred when starting a background process.
NERR_ShareNotFound = 0x00000958, // The shared resource you are connected to could not be found.
NERR_InvalidLana = 0x00000960, // The LAN adapter number is invalid.
NERR_OpenFiles = 0x00000961, // There are open files on the connection.
NERR_ActiveConns = 0x00000962, // Active connections still exist.
NERR_BadPasswordCore = 0x00000963, // This share name or password is invalid.
NERR_DevInUse = 0x00000964, // The device is being accessed by an active process.
NERR_LocalDrive = 0x00000965, // The drive letter is in use locally.
NERR_AlertExists = 0x0000097E, // The specified client is already registered for the specified event.
NERR_TooManyAlerts = 0x0000097F, // The alert table is full.
NERR_NoSuchAlert = 0x00000980, // An invalid or nonexistent alert name was raised.
NERR_BadRecipient = 0x00000981, // The alert recipient is invalid.
NERR_AcctLimitExceeded = 0x00000982, // A users session with this server has been deleted.
NERR_InvalidLogSeek = 0x00000988, // The log file does not contain the requested record number.
NERR_BadUasConfig = 0x00000992, // The user accounts database is not configured correctly.
NERR_InvalidUASOp = 0x00000993, // This operation is not permitted when the Netlogon service is running.
NERR_LastAdmin = 0x00000994, // This operation is not allowed on the last administrative account.
NERR_DCNotFound = 0x00000995, // The domain controller for this domain could not be found.
NERR_LogonTrackingError = 0x00000996, // The logon information for this user could not be set.
NERR_NetlogonNotStarted = 0x00000997, // The Netlogon service has not been started.
NERR_CanNotGrowUASFile = 0x00000998, // The user accounts database could not be added to.
NERR_TimeDiffAtDC = 0x00000999, // This servers clock is not synchronized with the primary domain controllers clock.
NERR_PasswordMismatch = 0x0000099A, // A password mismatch has been detected.
NERR_NoSuchServer = 0x0000099C, // The server identification does not specify a valid server.
NERR_NoSuchSession = 0x0000099D, // The session identification does not specify a valid session.
NERR_NoSuchConnection = 0x0000099E, // The connection identification does not specify a valid connection.
NERR_TooManyServers = 0x0000099F, // There is no space for another entry in the table of available servers.
NERR_TooManySessions = 0x000009A0, // The server has reached the maximum number of sessions it supports.
NERR_TooManyConnections = 0x000009A1, // The server has reached the maximum number of connections it supports.
NERR_TooManyFiles = 0x000009A2, // The server cannot open more files because it has reached its maximum number.
NERR_NoAlternateServers = 0x000009A3, // There are no alternate servers registered on this server.
NERR_TryDownLevel = 0x000009A6, // Try the down-level (remote admin protocol) version of the API instead.
NERR_UPSDriverNotStarted = 0x000009B0, // The UPS driver could not be accessed by the UPS service.
NERR_UPSInvalidConfig = 0x000009B1, // The UPS service is not configured correctly.
NERR_UPSInvalidCommPort = 0x000009B2, // The UPS service could not access the specified communications port.
NERR_UPSSignalAsserted = 0x000009B3, // The UPS indicated a line failure or low battery situation. The service was not started.
NERR_UPSShutdownFailed = 0x000009B4, // The UPS service failed to perform a system shutdown.
NERR_BadDosRetCode = 0x000009C4, // The program below returned an MS-DOS error code:
NERR_ProgNeedsExtraMem = 0x000009C5, // The program below needs more memory:
NERR_BadDosFunction = 0x000009C6, // The program below called an unsupported MS-DOS function:
NERR_RemoteBootFailed = 0x000009C7, // The workstation failed to boot.
NERR_BadFileCheckSum = 0x000009C8, // The file below is corrupt.
NERR_NoRplBootSystem = 0x000009C9, // No loader is specified in the boot-block definition file.
NERR_RplLoadrNetBiosErr = 0x000009CA, // NetBIOS returned an error: The NCB and SMB are dumped above.
NERR_RplLoadrDiskErr = 0x000009CB, // A disk I/O error occurred.
NERR_TooManyImageParams = 0x000009CD, // Too many image parameters cross disk sector boundaries.
NERR_NonDosFloppyUsed = 0x000009CE, // The image was not generated from an MS-DOS diskette formatted with /S.
NERR_RplBootRestart = 0x000009CF, // Remote boot will be restarted later.
NERR_RplSrvrCallFailed = 0x000009D0, // The call to the Remoteboot server failed.
NERR_CantConnectRplSrvr = 0x000009D1, // It is not possible to connect to the Remoteboot server.
NERR_CantOpenImageFile = 0x000009D2, // An image file on the Remoteboot server cannot be opened.
NERR_CallingRplSrvr = 0x000009D3, // Connecting to the Remoteboot server.
NERR_StartingRplBoot = 0x000009D4, // Connecting to the Remoteboot server.
NERR_RplBootServiceTerm = 0x000009D5, // Remote boot service was stopped; check the error log for the cause of the problem.
NERR_RplBootStartFailed = 0x000009D6, // Remote boot startup failed; check the error log for the cause of the problem.
NERR_RPL_CONNECTED = 0x000009D7, // A second connection to a Remoteboot resource is not allowed.
NERR_BrowserConfiguredToNotRun = 0x000009F6, // The browser service was configured with MaintainServerList=No.
NERR_RplNoAdaptersStarted = 0x00000A32, // The service failed to start because none of the network adapters started with this service.
NERR_RplBadRegistry = 0x00000A33, // The service failed to start because of bad startup information in the registry.
NERR_RplBadDatabase = 0x00000A34, // The service failed to start because its database is absent or corrupt.
NERR_RplRplfilesShare = 0x00000A35, // The service failed to start because the RPLFILES share is absent.
NERR_RplNotRplServer = 0x00000A36, // The service failed to start because the RPLUSER group is absent.
NERR_RplCannotEnum = 0x00000A37, // Service records cannot be enumerated.
NERR_RplWkstaInfoCorrupted = 0x00000A38, // Workstation record information has been corrupted.
NERR_RplWkstaNotFound = 0x00000A39, // A workstation record was not found.
NERR_RplWkstaNameUnavailable = 0x00000A3A, // A workstation name is in use by some other workstation.
NERR_RplProfileInfoCorrupted = 0x00000A3B, // Profile record information has been corrupted.
NERR_RplProfileNotFound = 0x00000A3C, // A profile record was not found.
NERR_RplProfileNameUnavailable = 0x00000A3D, // A profile name is in use by some other profile.
NERR_RplProfileNotEmpty = 0x00000A3E, // There are workstations using this profile.
NERR_RplConfigInfoCorrupted = 0x00000A3F, // Configuration record information has been corrupted.
NERR_RplConfigNotFound = 0x00000A40, // A configuration record was not found.
NERR_RplAdapterInfoCorrupted = 0x00000A41, // Adapter ID record information has been corrupted.
NERR_RplInternal = 0x00000A42, // An internal service error has occurred.
NERR_RplVendorInfoCorrupted = 0x00000A43, // Vendor ID record information has been corrupted.
NERR_RplBootInfoCorrupted = 0x00000A44, // Boot block record information has been corrupted.
NERR_RplWkstaNeedsUserAcct = 0x00000A45, // The user account for this workstation record is missing.
NERR_RplNeedsRPLUSERAcct = 0x00000A46, // The RPLUSER local group could not be found.
NERR_RplBootNotFound = 0x00000A47, // A boot block record was not found.
NERR_RplIncompatibleProfile = 0x00000A48, // The chosen profile is incompatible with this workstation.
NERR_RplAdapterNameUnavailable = 0x00000A49, // The chosen network adapter ID is in use by some other workstation.
NERR_RplConfigNotEmpty = 0x00000A4A, // There are profiles using this configuration.
NERR_RplBootInUse = 0x00000A4B, // There are workstations, profiles, or configurations using this boot block.
NERR_RplBackupDatabase = 0x00000A4C, // The service failed to backup a Remoteboot database.
NERR_RplAdapterNotFound = 0x00000A4D, // An adapter record was not found.
NERR_RplVendorNotFound = 0x00000A4E, // A vendor record was not found.
NERR_RplVendorNameUnavailable = 0x00000A4F, // A vendor name is in use by some other vendor record.
NERR_RplBootNameUnavailable = 0x00000A50, // (boot name, vendor ID) is in use by some other boot block record.
NERR_RplConfigNameUnavailable = 0x00000A51, // A configuration name is in use by some other configuration.
NERR_DfsInternalCorruption = 0x00000A64, // The internal database maintained by the Dfs service is corrupt.
NERR_DfsVolumeDataCorrupt = 0x00000A65, // One of the records in the internal Dfs database is corrupt.
NERR_DfsNoSuchVolume = 0x00000A66, // There is no Dfs name whose entry path matches the input entry path.
NERR_DfsVolumeAlreadyExists = 0x00000A67, // A root or link with the given name already exists.
NERR_DfsAlreadyShared = 0x00000A68, // The server share specified is already shared in the Dfs.
NERR_DfsNoSuchShare = 0x00000A69, // The indicated server share does not support the indicated Dfs namespace.
NERR_DfsNotALeafVolume = 0x00000A6A, // The operation is not valid on this portion of the namespace.
NERR_DfsLeafVolume = 0x00000A6B, // The operation is not valid on this portion of the namespace.
NERR_DfsVolumeHasMultipleServers = 0x00000A6C, // The operation is ambiguous because the link has multiple servers.
NERR_DfsCantCreateJunctionPoint = 0x00000A6D, // A link could not be created.
NERR_DfsServerNotDfsAware = 0x00000A6E, // The server is not Dfs aware.
NERR_DfsBadRenamePath = 0x00000A6F, // The specified rename target path is invalid.
NERR_DfsVolumeIsOffline = 0x00000A70, // The specified Dfs link is offline.
NERR_DfsNoSuchServer = 0x00000A71, // The specified server is not a server for this link.
NERR_DfsCyclicalName = 0x00000A72, // A cycle in the Dfs name was detected.
NERR_DfsNotSupportedInServerDfs = 0x00000A73, // The operation is not supported on a server-based Dfs.
NERR_DfsDuplicateService = 0x00000A74, // This link is already supported by the specified server share.
NERR_DfsCantRemoveLastServerShare = 0x00000A75, // The last server share supporting this root or link cannot be removed.
NERR_DfsVolumeIsInterDfs = 0x00000A76, // The operation is not supported for an inter-Dfs link.
NERR_DfsInconsistent = 0x00000A77, // The internal state of the Dfs service has become inconsistent.
NERR_DfsServerUpgraded = 0x00000A78, // The Dfs service has been installed on the specified server.
NERR_DfsDataIsIdentical = 0x00000A79, // The Dfs data being reconciled is identical.
NERR_DfsCantRemoveDfsRoot = 0x00000A7A, // The Dfs root cannot be deleted. Uninstall Dfs if required.
NERR_DfsChildOrParentInDfs = 0x00000A7B, // A child or parent directory of the share is already in a Dfs.
NERR_DfsInternalError = 0x00000A82, // A Dfs internal error occurred.
NERR_SetupAlreadyJoined = 0x00000A83, // This computer is already joined to a domain.
NERR_SetupNotJoined = 0x00000A84, // This computer is not currently joined to a domain.
NERR_SetupDomainController = 0x00000A85, // This computer is a domain controller and cannot be unjoined from a domain.
NERR_DefaultJoinRequired = 0x00000A86, // The destination domain controller does not support creating machine accounts in OUs.
NERR_InvalidWorkgroupName = 0x00000A87, // The specified workgroup name is invalid.
NERR_NameUsesIncompatibleCodePage = 0x00000A88, // The specified computer name is incompatible with the default language used on the domain controller.
NERR_ComputerAccountNotFound = 0x00000A89, // The specified computer account could not be found.
NERR_PersonalSku = 0x00000A8A, // This version of Windows cannot be joined to a domain.
NERR_PasswordMustChange = 0x00000A8D, // The password must change at the next logon.
NERR_AccountLockedOut = 0x00000A8E, // The account is locked out.
NERR_PasswordTooLong = 0x00000A8F, // The password is too long.
NERR_PasswordNotComplexEnough = 0x00000A90, // The password does not meet the complexity policy.
NERR_PasswordFilterError = 0x00000A91, // The password does not meet the requirements of the password filter DLLs.
RPC_E_UNEXPECTED = 0x8001FFFF, // An internal error occurred.
CO_E_CANCEL_DISABLED = 0x80010140, // Call cancellation is disabled.
CO_E_ACNOTINITIALIZED = 0x8001013F, // The COM IAccessControl object is not initialized.
CO_E_DECODEFAILED = 0x8001013D, // The ACL in the stream provided by the user could not be decoded.
CO_E_FAILEDTOOPENPROCESSTOKEN = 0x8001013C, // The access token of the server process could not be opened.
CO_E_INCOMPATIBLESTREAMVERSION = 0x8001013B, // The version of ACL format in the stream is not supported by this implementation of IAccessControl.
CO_E_ACESINWRONGORDER = 0x8001013A, // Not all the DENY_ACCESS ACEs are arranged in front of the GRANT_ACCESS ACEs in the stream.
CO_E_EXCEEDSYSACLLIMIT = 0x80010139, // The number of ACEs in an ACL exceeds the system limit.
CO_E_FAILEDTOCLOSEHANDLE = 0x80010138, // A serialization handle or a file handle could not be closed.
CO_E_FAILEDTOCREATEFILE = 0x80010137, // A file could not be created.
CO_E_FAILEDTOGENUUID = 0x80010136, // A universally unique identifier (UUID) could not be generated.
CO_E_PATHTOOLONG = 0x80010135, // A path is too long.
CO_E_FAILEDTOGETWINDIR = 0x80010134, // The Windows directory could not be obtained.
CO_E_SETSERLHNDLFAILED = 0x80010133, // A serialization handle could not be set or reset.
CO_E_LOOKUPACCNAMEFAILED = 0x80010132, // The system function LookupAccountName failed.
CO_E_NOMATCHINGNAMEFOUND = 0x80010131, // A trustee name that corresponds to a security identifier provided by the user could not be found.
CO_E_LOOKUPACCSIDFAILED = 0x80010130, // The system function LookupAccountSID failed.
CO_E_NOMATCHINGSIDFOUND = 0x8001012F, // A security identifier that corresponds to a trustee string provided by the user could not be found.
CO_E_CONVERSIONFAILED = 0x8001012E, // A wide character trustee string could not be converted to a multibyte trustee string.
CO_E_INVALIDSID = 0x8001012D, // One of the security identifiers provided by the user was invalid.
CO_E_WRONGTRUSTEENAMESYNTAX = 0x8001012C, // One of the trustee strings provided by the user did not conform to the <Domain>\<Name> syntax, and it was not the "*" string.
CO_E_NETACCESSAPIFAILED = 0x8001012B, // Either NetAccessDel or NetAccessAdd returned an error code.
CO_E_ACCESSCHECKFAILED = 0x8001012A, // The system function AccessCheck returned false.
CO_E_FAILEDTOSETDACL = 0x80010129, // A discretionary ACL into a security descriptor could not be set.
CO_E_FAILEDTOQUERYCLIENTBLANKET = 0x80010128, // The clients security blanket could not be obtained.
CO_E_TRUSTEEDOESNTMATCHCLIENT = 0x80010127, // The client that called IAccessControl::IsAccessPermitted was not the trustee provided to the method.
CO_E_FAILEDTOGETTOKENINFO = 0x80010126, // User information could not be obtained from an access token.
CO_E_FAILEDTOOPENTHREADTOKEN = 0x80010125, // The access token of the current thread could not be opened.
CO_E_FAILEDTOGETSECCTX = 0x80010124, // The servers security context could not be obtained.
CO_E_FAILEDTOIMPERSONATE = 0x80010123, // A DCOM client could not be impersonated.
RPC_E_INVALID_STD_NAME = 0x80010122, // The principal name is not a valid MSSTD name.
RPC_E_FULLSIC_REQUIRED = 0x80010121, // A full subject issuer chain SSL principal name is expected from the server.
RPC_E_NO_SYNC = 0x80010120, // There are no synchronize objects to wait for.
RPC_E_TIMEOUT = 0x8001011F, // This operation returned because the time-out period expired.
RPC_E_NO_CONTEXT = 0x8001011E, // No context is associated with this call. This error occurs for some custom marshaled calls and on the client side of the call.
RPC_E_INVALID_OBJREF = 0x8001011D, // The marshaled interface data packet (OBJREF) has an invalid or unknown format.
RPC_E_REMOTE_DISABLED = 0x8001011C, // Remote calls are not allowed for this process.
RPC_E_ACCESS_DENIED = 0x8001011B, // Access is denied.
RPC_E_NO_GOOD_SECURITY_PACKAGES = 0x8001011A, // Either no security packages are installed on this computer, the user is not logged on, or there are no compatible security packages between the client and server.
RPC_E_TOO_LATE = 0x80010119, // Security must be initialized before any interfaces are marshaled or unmarshaled. It cannot be changed once initialized.
RPC_E_UNSECURE_CALL = 0x80010118, // Impersonate on unsecure calls is not supported.
RPC_E_CALL_COMPLETE = 0x80010117, // Call context cannot be accessed after a call is completed.
RPC_S_WAITONTIMER = 0x80010116, // OLE is waiting before retrying a request.
RPC_S_CALLPENDING = 0x80010115, // OLE has sent a request and is waiting for a reply.
RPC_E_INVALID_OBJECT = 0x80010114, // The requested object does not exist.
RPC_E_INVALID_IPID = 0x80010113, // The requested object or interface does not exist.
RPC_E_INVALID_EXTENSION = 0x80010112, // OLE received a packet with an invalid extension.
RPC_E_INVALID_HEADER = 0x80010111, // OLE received a packet with an invalid header.
RPC_E_VERSION_MISMATCH = 0x80010110, // The versions of OLE on the client and server computers do not match.
RPC_E_THREAD_NOT_INIT = 0x8001010F, // The COM function CoInitialize has not been called on the current thread. For more information on CoInitialize, see CoInitialize on Microsoft Developer Network (MSDN).
RPC_E_WRONG_THREAD = 0x8001010E, // The application called an interface that was marshaled for a different thread.
RPC_E_CANTCALLOUT_ININPUTSYNCCALL = 0x8001010D, // An outgoing call cannot be made because the application is dispatching an input-synchronous call.
RPC_E_INVALID_CALLDATA = 0x8001010C, // A call control interface was called with invalid data.
RPC_E_SERVERCALL_REJECTED = 0x8001010B, // The message filter rejected the call.
RPC_E_SERVERCALL_RETRYLATER = 0x8001010A, // The message filter indicated that the application is busy.
RPC_E_RETRY = 0x80010109, // The object invoked chose not to process the call now. Try again later.
RPC_E_DISCONNECTED = 0x80010108, // The object invoked has disconnected from its clients.
RPC_E_INVALIDMETHOD = 0x80010107, // The method called does not exist on the server.
RPC_E_CHANGED_MODE = 0x80010106, // Thread mode cannot be changed after it is set.
RPC_E_SERVERFAULT = 0x80010105, // The server threw an exception.
RPC_E_FAULT = 0x80010104, // RPC could not call the server or could not return the results after calling the server.
RPC_E_NOT_REGISTERED = 0x80010103, // The requested interface is not registered on the server object.
RPC_E_ATTEMPTED_MULTITHREAD = 0x80010102, // Calls on more than one thread were attempted in single threaded mode.
RPC_E_OUT_OF_RESOURCES = 0x80010101, // Some required resource such as memory or events could not be allocated.
RPC_E_SYS_CALL_FAILED = 0x80010100, // A system call failed.
RPC_E_SERVER_DIED_DNE = 0x80010012, // The called server is not available and disappeared; all connections are invalid. The call did not execute.
RPC_E_CANTCALLOUT_AGAIN = 0x80010011, // There is no second outgoing call on same channel in DDE conversation.
RPC_E_INVALID_PARAMETER = 0x80010010, // A particular parameter is invalid and cannot be unmarshaled.
RPC_E_INVALID_DATA = 0x8001000F, // The rReceived data is invalid; the data could be server or client data.
RPC_E_SERVER_CANTUNMARSHAL_DATA = 0x8001000E, // The called server cannot unmarshal the parameter data for reasons such as low memory.
RPC_E_SERVER_CANTMARSHAL_DATA = 0x8001000D, // The called server cannot marshal the return data for reasons such as low memory.
RPC_E_CLIENT_CANTUNMARSHAL_DATA = 0x8001000C, // The calling client cannot unmarshal the return data for reasons such as low memory.
RPC_E_CLIENT_CANTMARSHAL_DATA = 0x8001000B, // The calling client cannot marshal the parameter data for reasons such as low memory.
RPC_E_CANTTRANSMIT_CALL = 0x8001000A, // The call was not transmitted properly; the message queue was full and was not emptied after yielding.
RPC_E_INVALID_DATAPACKET = 0x80010009, // The data packet with the marshaled parameter data is incorrect.
RPC_E_CLIENT_DIED = 0x80010008, // The calling client disappeared while the called server was processing a call.
RPC_E_SERVER_DIED = 0x80010007, // The called server is not available and has disappeared; all connections are invalid. The call might have executed.
RPC_E_CONNECTION_TERMINATED = 0x80010006, // The connection terminated or is in an invalid state and cannot be used any more. Other connections are still valid.
RPC_E_CANTCALLOUT_INEXTERNALCALL = 0x80010005, // It is invalid to call out while inside a message filter.
RPC_E_CANTCALLOUT_INASYNCCALL = 0x80010004, // The caller is dispatching an asynchronous call and cannot make an outgoing call on behalf of this call.
RPC_E_CANTPOST_INSENDCALL = 0x80010003, // The caller is dispatching an intertask SendMessage call and cannot call out using PostMessage.
RPC_E_CALL_CANCELED = 0x80010002 // The call was canceled by the message filter.
}
public class UnsafeNativeMethods
{
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcBindingFromStringBinding(
string StringBinding,
out IntPtr Binding
);
[DllImport("Rpcrt4.dll")]
public static extern int RpcBindingFree(
ref IntPtr Binding
);
[DllImport("Rpcrt4.dll")]
public static extern int RpcStringFree(
ref IntPtr String
);
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcMgmtEpEltInqBegin(
IntPtr EpBinding,
int InquiryType, // 0x00000000 = RPC_C_EP_ALL_ELTS
int IfId,
int VersOption,
string ObjectUuid,
out IntPtr InquiryContext
);
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcMgmtEpEltInqNext(
IntPtr InquiryContext,
out RPC_IF_ID IfId,
out IntPtr Binding,
out Guid ObjectUuid,
out IntPtr Annotation
);
[DllImport("Rpcrt4.dll", CharSet = CharSet.Auto)]
public static extern int RpcBindingToStringBinding(
IntPtr Binding,
out IntPtr StringBinding
);
}
public struct RPC_IF_ID
{
public Guid Uuid;
public ushort VersMajor;
public ushort VersMinor;
}
}
'
}
process {
foreach ($computer In $ComputerName) {
$netConnection = Test-NetConnection -ComputerName $computer -Port 135
[PSCustomObject]@{
ComputerName = $computer
RemoteAddress = $netConnection.RemoteAddress
RemotePort = 135
TestSucceeded = $netConnection.TcpTestSucceeded
RpcCode = $null
}
if (-not $netConnection.TcpTestSucceeded) {
return
}
try {
$bindingHandle = [IntPtr]::Zero
$returnCode = [Rpc.UnsafeNativeMethods]::RpcBindingFromStringBinding(
('ncacn_ip_tcp:{0}' -f $computer),
[ref] $bindingHandle
)
if ($returnCode -ne 0) {
throw 'RpcBindingFromStringBinding failed'
}
$inquiryContext = [IntPtr]::Zero
$returnCode = [Rpc.UnsafeNativeMethods]::RpcMgmtEpEltInqBegin(
$bindingHandle,
0,
0,
0,
[string]::Empty,
[ref] $inquiryContext
)
if ($returnCode -ne [Rpc.RpcReturnCode]::TRPC_S_OKBD) {
throw 'RpcMgmtEpEltInqBegin failed'
}
do {
$elementIfId = [Rpc.RPC_IF_ID]::new()
$elementBindingHandle = [IntPtr]::Zero
$elementUuid = New-Guid
$elementAnnotation = [IntPtr]::Zero
$returnCode = [Rpc.UnsafeNativeMethods]::RpcMgmtEpEltInqNext(
$inquiryContext,
[ref] $elementIfId,
[ref] $elementBindingHandle,
[ref] $elementUuid,
[ref] $elementAnnotation
)
if ($returnCode -eq [Rpc.RpcReturnCode]::TRPC_S_OKBD) {
$bindString = [IntPtr]::Zero
$returnCode = [Rpc.UnsafeNativeMethods]::RpcBindingToStringBinding(
$elementBindingHandle,
[ref] $bindString
)
[PSCustomObject]@{
ComputerName = $computer
RemoteAddress = $netConnection.RemoteAddress
RemotePort = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bindString) -replace '.+\[|\]'
TestSucceeded = $returnCode -eq [Rpc.RpcReturnCode]::TRPC_S_OKBD
RpcCode = $returnCode -as [Rpc.RpcReturnCode]
}
$null = [Rpc.UnsafeNativeMethods]::RpcStringFree(
[ref] $bindString
)
}
$null = [Rpc.UnsafeNativeMethods]::RpcBindingFree(
[ref] $elementBindingHandle
)
} until ($returnCode -eq [Rpc.RpcReturnCode]::RPC_X_NO_MORE_ENTRIES)
}
catch {
$pscmdlet.ThrowTerminatingError($_)
}
finally {
if ($bindingHandle -ne [IntPtr]::Zero) {
$null = [Rpc.UnsafeNativeMethods]::RpcBindingFree(
[ref] $bindingHandle
)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment