@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: removes one or more members from an existing local group !!!!C# Signature: [DllImport("NetApi32.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern Int32 NetLocalGroupDelMembers( string servername, string groupname, UInt32 level, ref LOCALGROUP_MEMBERS_INFO_3 buf, UInt32 totalentries ); !!!!VB Signature: Declare Function NetLocalGroupDelMembers Lib "netapi32.dll" (TODO) As TODO !!!!User-Defined Types: None. !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: struct LOCALGROUP_MEMBERS_INFO_3 { [MarshalAs(UnmanagedType.LPWStr)] public string Domain; } [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern bool LookupAccountSid( string SystemName, [MarshalAs(UnmanagedType.LPArray)] byte[] Sid, StringBuilder Name, ref uint NameCount, StringBuilder ReferencedDomainName, ref uint ReferencedDomainNameCount, out SID_NAME_USE SIDUse); public static bool DelUserFromGroup(string UserName) { bool bOk = false; StringBuilder sbName = new StringBuilder(); uint uiName = (uint)sbName.Capacity; StringBuilder sbReferencedDomainName = new StringBuilder(); uint uiReferencedDomainNameCount = (uint)sbReferencedDomainName.Capacity; SID_NAME_USE eUse; // Sid for BUILTIN\Administrators byte[] baSid = new byte[] { 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2 }; if (!LookupAccountSid(null, baSid, sbName, ref uiName, sbReferencedDomainName, ref uiReferencedDomainNameCount, out eUse)) return bOk; // prepare user name LOCALGROUP_MEMBERS_INFO_3 info; info.Domain = UserName; int iRetVal = 0; if ((iRetVal = NetLocalGroupDelMembers(null, sbName.ToString(), 3, ref info, 1)) != 0) bOk = true; return bOk; } Documentation: NetLocalGroupDelMembers@msdn on MSDN
Edit netapi32.netlocal...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.