471,338 Members | 1,294 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

removing sidHistory

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


Jun 27 '08 #1
3 3456
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: <EF@nospam.nospam>
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


Jun 27 '08 #2
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: <EF@nospam.nospam>
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


Jun 27 '08 #3
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@nospam.nospamwrote in message
news:A9**********************************@microsof t.com...
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:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>From: <EF@nospam.nospam>
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




Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeremy Owens-Boggs | last post: by
reply views Thread by sameer mowade via .NET 247 | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
7 posts views Thread by =?Utf-8?B?Sm9lbCBNZXJr?= | last post: by
reply views Thread by rosydwin | last post: by

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.