473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Need to convert some VB6 code to C#

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
Aug 7 '08 #1
1 1268

"Mushq" wrote:
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
Hi,

..Net comes with builtin support for Active Directory through
System.DirectoryServices. Add a reference to this dll in your project.

This article may prove helpful in manipulating group membership

[Programming With Groups]
http://msdn.microsoft.com/en-us/library/bb924542.aspx

--
Happy Coding!
Morten Wennevik [C# MVP]

Aug 7 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Google Jenny | last post by:
Precisely, here's what I need: When I run getdate(), I get, for example: August 9 2004 5:17 P.M. I want to turn the date portion into: 8/9/2004 format and update one column with it
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
8
by: John Bowman | last post by:
Hello, Does anyone have a good/reliable approach to implementing an IsNumeric() method that accepts a string that may represent a numerical value (eg. such as some text retrieved from an XML...
5
by: MFC | last post by:
Ok, after three C# books, (C# How to Program, Programming in the Key of C#, and C# Weekend Crash Course) and three weeks, I believe I have tried everything to make a certain form function...
3
by: ravi | last post by:
Hi, I am new to C++ .Can anyone please tell me what does ":" operator mean in C++.For ex: there is a program snippet which looks like that class convert { protected: double val1; // initial...
16
by: manmit.walia | last post by:
Hello All, I have tried multiple online tools to convert an VB6 (bas) file to VB.NET file and no luck. I was hoping that someone could help me covert this. I am new to the .NET world and still...
0
by: Pucca | last post by:
Hi I'm using vs2005. I am getting a bunch of compiler warnings after I made some changes to my code that was compiling clean. I'm also getting memory errors when I run my program and it's...
2
by: fatimahtaher | last post by:
Hi, I am new to C# programming and my first assignment requires me to calculate total interest paid on a loan. The user will input the loan, the interest rate per month, and the monthly payment....
8
by: manmit.walia | last post by:
Hello Everyone, Long time ago, I posted a small problem I had about converting a VB6 program to C#. Well with the help with everyone I got it converted. But I overlooked something and don't...
20
by: KW | last post by:
I have an application that runs in any of Access 2000 thru Access 2007 to accommodate my customers' various environments. I implemented code to call a function that uses the LoadCustomUI method to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.