This documentation is archived and is not being maintained.

MessageQueue.GetMachineId Method

Gets the identifier of the computer on which the queue referenced by this MessageQueue is located.

[Visual Basic]
Public Shared Function GetMachineId( _
   ByVal machineName As String _
) As Guid
public static Guid GetMachineId(
 string machineName
public: static Guid GetMachineId(
 String* machineName
public static function GetMachineId(
   machineName : String
) : Guid;


The name of the computer that contains the queue, without the two preceding backslashes (\\).

Return Value

A Guid that represents a unique identifier for the computer on which the queue is located.


Exception Type Condition
MessageQueueException The computer identifier could not be retrieved, possibly because the directory service is not available; for example, if you are working offline.


An error occurred when accessing a Message Queuing API.


You can use a computer's identifier for two purposes, among others: to read the computer journal and to set security certificates. However, you cannot call GetMachineId for a remote computer when you are working offline because the application must have access to the directory service on the domain controller.

The computer identifier (or "machine identifier") is a Guid that Message Queuing creates when a computer is added to the enterprise. Message Queuing combines the computer identifier with the Machine and Journal keywords to create the machine journal's format name, which has the syntax Machine=<computeridentifier>;Journal. The machine journal, which is also known as the journal queue, is a system queue that stores copies of application-generated messages when the UseJournalQueue property is true.

Note   This syntax for the journal is only valid when constructing the format name for the queue. The path name syntax is MachineName\Journal$.

The following table shows whether this method is available in various Workgroup modes.

Workgroup Mode Available
Local computer No
Local computer + direct format name No
Remote computer No
Remote computer + direct format name No


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | MachineName | UseJournalQueue