Partager via


Visual Basic Code Example: Verifying Workgroup Installation

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

This example provides a private function that verifies that the local Message Queuing service is running in workgroup mode by checking to see whether the local computer belongs to a domain and whether Message Queuing is configured to use the directory service.

This function looks at the MSMQApplication.IsDSEnabled property of the local Message Queuing service, returning a Boolean value that indicates whether the local service is configured to use the directory service. The property returns False if the computer is part of a workgroup.

For information on operating in a workgroup, see Workgroup Support.

To verify workgroup installation

  1. Declare the MSMQApplication variable.

  2. Optional, inspect value of MSMQApplication.IsDSEnabled property.

  3. Set the return value of VerifyWorkgroupMode function.

Code Example

The following code example requires MSMQ 2.0 or later.

Private Function VerifyWorkgroupMode (Void) As Boolean  
  
  'Declare variables.  
  Dim app As New MSMQApplication  
  
  ' Check if local computer is configured to use the directory service.  
  If app.IsDSEnabled Then  
    MsgBox "The local computer is not operating in workgroup mode."   
  Else  
    MsgBox "The local computer is operating in workgroup mode."   
  End If  
  ' Return results.  
  VerifyWorkgroupMode = app.IsDsEnabled  
  
End Function