How to find user group/memberof profile?

From: Robin M via .NET 247 (anonymous_at_dotnet247.com)
Date: 05/13/04


Date: Wed, 12 May 2004 21:58:21 -0700

I want to check if the user who is running the program has administrative right or not. I am using following code to check all the property names but I couldn't find "memberof" property ( as suggested in many forums/sites ).

I am using the following code. Is there any other way to check if the logged user belongs to Administrator group or not. I am using Win 2000 platform.

Dim ADRootDSE As System.DirectoryServices.DirectoryEntry = New System.DirectoryServices.DirectoryEntry()

ADRootDSE.Path = "WinNT://domainservername"

ADRootDSE.Username = "robin"

ADRootDSE.Password = "abc"

Dim propName As String

Dim value As String

Dim obj As Object

For Each propName In ADRootDSE.Properties.PropertyNames

Console.WriteLine("name= " & propName)

obj = ADRootDSE.Properties(propName).Value

value = CType(obj, String)

Next propName

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>Ck+0AO2Fsk2uQJMIY+1QwQ==</Id>



Relevant Pages

  • Re: Get Property value of class instance by passing string property name
    ... Dim PropName As String ... Dim Obj As New Class1 ...
    (microsoft.public.excel.programming)
  • Run-time error..
    ... Dim varTNum As String, varPW As String ... contact the Administrator.", vbExclamation, "Incorrect Password" ...
    (comp.databases.ms-access)
  • RE: Exception Handling Block not writing to Vista Event Log
    ... you try to create the following register key if it did not ... If rkEventSource Is Nothing Then ... UAC is on and you don't run the application as Administrator, ... Dim sourceName As String = "Driver Documents Manager" ...
    (microsoft.public.vsnet.general)
  • Re: Grey marks indicating margins
    ... I'm logged in as an Administrator. ... string you suggested and it brought up many, ... > and a Chinese language choice through the ... > Yes I still see the marks when I open Word in safe mode and I have Asian ...
    (microsoft.public.word.docmanagement)
  • RE: Change local administrator password for all PCs in the domain
    ... > administrator account is not name "Administrator" also this uses the SID of ... > the Local Administrator account so if it is NOT named Administrator it will ... > dim gobjConnection, gobjCommand ... > Public Sub ChangeLocalAdmin ...
    (microsoft.public.windows.server.scripting)

Loading