Re: removing sidHistory
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Fri, 25 Apr 2008 18:31:20 +0200
Note that you should not translate VBScript samples to C# or any .NET language for that matter), .NET offers a rich class library to be used from managed code, these class libraries make it much easier to access AD objects than it was ever possible from unmanaged code.
The .NET way to clear the SID-History looks something like this:
using(DirectoryEntry root = new DirectoryEntry(@"LDAP://RootDSE"))
{
string defCtx = root.Properties["defaultNamingContext"][0].ToString();
using(DirectoryEntry re = new DirectoryEntry("LDAP://" + defCtx))
{
PropertyValueCollection sidH = re.Properties["sidHistory"];
if(sidH.Count > 0)
{
sidH.Clear();
re.CommitChanges();
}
}
}
Willy.
"Alex" <EF@xxxxxxxxxxxxx> wrote in message news:A97CCB44-28ED-4EA9-B1C0-BC8BC6AF7C8A@xxxxxxxxxxxxxxxx
Hi Steven,
Yup, I have seen that KBA before. I agree that it should be easier to
convert vbscript to VB.Net but since I am learning C# so I thought of doing
it in C#. Anyway, I have get it working.
Thanks,
Alex
"Steven Cheng [MSFT]" wrote:
Hi Alex,
As for cleaning sidhistory, so far what I found is the following kb article
which provide the vbscript for cleaning sidhistory:
#How To Use Visual Basic Script to Clear SidHistory
http://support.microsoft.com/?id=295758
have you tried using VB.NET code which maybe easy to convert from vb. Or
you can consider keep the vbs script and use C# to programmtically invoke
cmd to execute the vbscript.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: <EF@xxxxxxxxxxxxx>
>Subject: removing sidHistory
>Date: Fri, 25 Apr 2008 00:08:49 +0800
>
>Hi All,
>
>Have anyone tried to remove sidHistory using C#?
>
>I keep getting the following error when I use the PutEx method.
>
>System.Runtime.InteropServices.COMException was unhandled
> Message="Unspecified error\r\n"
> Source="Active Directory"
> ErrorCode=-2147467259
> StackTrace:
> at ActiveDs.IADs.PutEx(Int32 lnControlCode, String bstrName, > Object
>vProp)
>
>
>Thanks,
>Alex
>
>
>
>
>
.
- References:
- removing sidHistory
- From: EF
- RE: removing sidHistory
- From: Steven Cheng [MSFT]
- RE: removing sidHistory
- From: Alex
- removing sidHistory
- Prev by Date: Object reference question
- Next by Date: Re: Object reference question
- Previous by thread: RE: removing sidHistory
- Next by thread: Reading data from a dataset
- Index(es):
Relevant Pages
|