Community discussion forum

VB6 to C# Conversion program

  • 3 months ago

    Hi,

    I want to convert following VB6 code to C#, can some one help me regarding that.

    // Code starts here 

    strComputer = "atl-ws-01"

    Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")

    For Each objUser In objGroup.Members
        If objUser.Name <> "Administrator" AND objUser.Name <> "Domain Admins" Then
            objGroup.Remove(objUser.AdsPath)
        End If
    Next

    // Code end here

    actually it is removing users from Local administrator group.

    or if some one knows how to delete users from local administrator group in C#.

    Thanks,

    Mushq

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 3 months ago

Post a reply

Enter your message below

Sign in or Join us (it's free).