.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Unable to delete computer object in AD using .net but able to do so using the console

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :.NET Framework

Hi everyone.

I am having a problem when trying to delete a computer from AD.

I am working on an application to create and delete computer objects in Active Directory

If the application created the computer object, there is no problem deleting it again, but if the computer object is created by another user, I get access denied. And here is where it get realy strange. If I open the Active Directory Users and Computers, with the same account I am using in the application, I can delete it, but I can not delete the object from my application.

I have tried to set the permissions for the object to Full and then it is posible to delete the object, but only if I set the permissions to Full. If I select every permission exept Full, I get Access Denied.

Is there any of you that has seen this behavior before or has and idea to why this is happening?

Any help is appreciated.

This is the function I use for deleting the computer object. strComputer is the ldap path for the computer object. 

Dim objComputer As DirectoryEntry

   objComputer = New DirectoryEntry(strComputer, "domain\username", 

View Complete Post

More Related Resource Links

Whistler: Build More Flexible Console Snap-ins with the MMC 2.0 Object Model


Microsoft Management Console (MMC) 2.0 provides a host of exciting new features for MMC users and snap-in developers. The new MMC 2.0 automation object model allows much of the user interface of MMC 2.0 to be accessed through script, and exposes events so that many tasks can now easily be automated. The new view extension model uses HTML to enable extensions to seamlessly integrate new user interfaces with those of existing snap-ins. MMC 2.0 also includes a specific view extension snap-in, the Extended View snap-in, which provides an interface similar to Web folders. Drag and drop support has been expanded, and console files now use the XML file format. Enhancements to console taskpads make it easier to accomplish tasks.

Vivek Jhaveri

MSDN Magazine March 2001

Unable to cast object of type 'System.Web.Mvc.ValueProviderResult' to type 'System.IConvertible'


 Why am I getting this error on line:

               sp.Price = Convert.ToDecimal(collection.GetValue("Price"));

sp is :
  SPecials_Templates sp = new SPecials_Templates();

SPecials_Templates Defined:

    public partial class SPecials_Templates
        public class SPecials_TemplatesMetaData

            public object Key { get; set; }
            public object Template_Name { get; set; }
            public object Headline { get; set; }

Unable to Cast COM object

All, I receive this error when I tried to create SSIS project and add or create new SSIS package inside. Link to image as unable to insert here as directed in this link. Error:  Mircrosoft Visual Studio is unable to load this document: Unable to cast COM object of type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.PackageNeutralClass' to interface type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackageSigning100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A896D87C-D1B2-4FAE-9339-CFAFEFE617BE}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)) Possible Reason: 1. I was running on SQL Server 2008 R2 Evaluation Edition but I uninstall it and installed SQL Server 2008 Developer Edition with SP2 (CTP) first but when I see this problem so I uninstalled SP2 and now running on SQL Server 2008 with SP1. 2. I was also running on Visual Studio 2010 Professional Edition along with SQL 2008 R2 but I uninstall both same time when I installed SQL Server 2008 Dev edition. My OS is Windows XP SP3 and SQL Server 2008 SP1 as I mentioned.   I tried below steps but no luck  1. Registering DLL in this link. http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/7f5c9ae1-ecd3-4ead-98fd-2d074720e31d/ 2. Follow article

how run my C# console application when i start the computer ?

hi i have build a console application (any listener) and i need that when i open the computer - this application will run. i don't have installation for hem (it a simple little .exe file) is there any way to do it through my C# code ? thank's in advance

unable to delete a column from library in sharepoint 2007

Hi When deleting  any column in document library we are getting the below error Unable to validate data.   at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)    at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) Also tried to hide/remove the search content place hoder in master page but nothing works. Removed our custom master page with default master page still no changes are being observed. Thanks & Regards. Prerna

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Object canno

hello,i am using a web servicewrtitten in .net and i access the webservice from my wepApplication i get this error System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Object cannot be cast from DBNull to other types.my code is access webservice: protected void btnSave_Click(object sender, EventArgs e)        {            int intStatusCode;            dtProjectStatus = (DataTable)ViewState["dtProjectStatus"];            try            {                objService.Credentials = System.Net.CredentialCache.DefaultCredentials;                if(dtProjectStatus.Rows.Count>0)                {                  intStatusCode = objService.InsertTest(dtProjectStatus);                }   

Unable to install SQL Server 2005 Express: The error is (-2146885628) Cannot find object or propert

I am installing 2 instances of SQL Server 2005 Express for 2 different accounting packages on Windows XP SP3.  I have the first installed, after much use of the forums.  The version of setup.exe was 2005.90.2047.0. I am not able to install the second, for Microsoft Office Accounting 2009, setup.exe version 2005.90.3042.0.  The error I am getting in Summary.txt is: Error String    : The SQL Server service failed to start. For more information, see the SQL Server Books Online topics, "How to: View SQL Server 2005 Setup Log Files" and "Starting SQL Server Manually." The error is  (-2146885628) Cannot find object or property. Error Number    : 29503 The errorlog file for MSSQL.2 has a lengthier description: 2009-09-05 23:00:32.13 Server      Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86)     Feb  9 2007 22:47:07     Copyright (c) 1988-2005 Microsoft Corporation     Express Edition on Windows NT 5.1 (Build 2600: Service Pack 3) 2009-09-05 23:00:32.31 Server      (c) 2005 Microsoft Corporation. 2009-09-05 23:00:32.31 Server      All rights reserved. 2009-09-05 23:00:32.32 Server      Server process ID is 5516. 2009-09-05 23:00:32.32 Server      Authentication mode is MIXED. 2009-09-05 23:00:32.35 Server      Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\LOG\ERRORLOG'. 2009-09-05 23:00:32.38 Server      Regi

Unable to delete orphan user from sysusers

SQL Server 2005 I have an orphan user in the application database called  [ \opdbo]These are the following these i have tried       sp_droplogin   '[\opdbo]' go sp_dropuser   '[\opdbo]' go sp_dropalias   '[\opdbo]'   EXEC   sp_addlogin '[\opdbo]' , 'Test123', 'opprod' GO EXEC   sp_change_users_login 'update_one','[\opdbo]' , '[\opdbo]' zero rows come up with this query SELECT   UserName = name FROM sysusers WHERE   issqluser = 1 and (sid is not null and sid <> 0x0) and   suser_sname(sid) is null ORDER   BY name     But the user shows up in select * from sysusers   I did find some articles where it says to sign in as DAC.  Is there any other way to delete this user? Lori

Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset'


Unable to cast object of type problem

hi I'm having a problem in this code: Public Function GetChannelList() As List(Of channel) Implements IChannelService.GetChannelList         Dim db As ChannelDataContext = New ChannelDataContext         Dim channelMatch = From channelRow In db.channels _                           Join parentChild In db.ChannelParentChildListings _                           On channelRow.channel_id Equals parentChild.parent_id _                           Order By channelRow.title Ascending _                           Select channelRow.channel_id, channelRow.title, parentChild.child,   parentChild.child_id           Return channelMatch    <-------- Error throw Unable to cast object of type 'System.Data.Linq.DataQuery`1[VB$AnonymousType_1`4[S

Unable to cast object of type 'System.Guid' to type 'System.String'.

protected void Button1_Click(object sender, EventArgs e) { using (BurnbetDataContext dc = new BurnbetDataContext()) { var q = (from c in dc.GetTable<tbl_Payment>() where c.ID == 5 select c).Single<tbl_Payment>(); dc.GetTable<tbl_Payment>().DeleteOnSubmit(q); dc.SubmitChanges(); } } }System.InvalidCastException was unhandled by user code  Message=Unable to cast object of type 'System.Guid' to type 'System.String'.  Source=System.Data.Linq  StackTrace:       at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)       at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)       at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)       at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)&nb

Unable to Create Object Variable for Linq Data Class


For some unknown reason I suddenly am unable to create an object variable for a Linq Data Class. If I create a new project and try the process again with the same database everything works as advertized.

The code I am using is Dim db As New RoggDataContext  which gives me an error on the object variable "db": Overload resolution failed because no accessibility 'NEW'  accepts this number of arguments.

I have looked inside every file in the Web Project like the web config to check the connection string, gobal, and designer.vb looking for any errors whit no JOY.  I also tried to create a new form and code behind with a button and received the same error.

This is mind blowing because as I already stated, I can create a new Web Site and the problem goes away.

Any help is appreciated!



Unable to delete groups in SharePoint Foundation 2010

I have a test group I created in SharePoint that I want to delete (I'm the only user in the group). In the "People and Groups: All Groups" screen I click the edit icon next to the group and then click on the "Delete" button and ok the following warning dialog. However, the group doesn't get deleted. Any idea why this is happening and how to finally delete this group? Thanks.

Unable to delete a "Web Application" In sharepoint central administration


Hello All..

I am struck here with a peculiar problem I have created a new web application to work with.

And now i want to delete that but sharepoint is not enabling some icons in ribbon like delete option.

Please enlighten me how can I delete that web application.

How to get nodes based on some values, update other element or delete that whole object



This is my xml string.

<xml version="1.0" encoding="utf-16">
    <x> test value 1 </x>
    <y> test value 2</y>

        <x> test value 3</x>
        <y> test value 4</y>

                <x> test value 5</x>
                <y> test value 6 </y>

                <x> test value 7</x>
                <y> test value 8 </y>

                    <x> test value 9</x>
                    <y> test value 6</y>







I have a big xml same as above containing a deep hierarchy.

Now, I am looking to do two things.

1. I want to find a particular node/obj by checking <x> element value. so I want to get node ofwhich <x> value is "test value 3" and for that object, I want to update <y> value to "Some New Value".

2. I want to find all the nodes/objects by checking <y> element value is "test value 6" OR "test value 8" OR "test value

Unable to cast object of type 'System.DBNull' to type 'System.String'.


 I saw lots of post about this issue. but haven't got good solution for that yet. Basically, what I did is that: I have a table in SQL database and some of data fields allow null. I built Objectdatasource through dataset. When I built update page using dataset. It generate the following error before showing the update page correctly. It seems I have issue to retrieve the null value from the database through using objectdatasource through dataset. Any suggestions?




Error attached below:

Unable to cast object of type 'System.DBNull' to type 'System.String'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.

Source Error:

Line 1178:            get {
Line 1179:                try {
Line 1180:                    return ((string)(this[this.tablemember.CurrentCityStateColumn]));
Line 1181:                

Default Calendar modification, unable to delete fields


Hello.  I'm new to Sharepoint Foundations 2010 (i've used Sharepoint Portal Server2007 and all the prior versions).  I would like to use the default calendar as a template but cannot delete the fields I do not want to use.  What are the steps to remove the fields (Something involving the Event Content Type) I do not wish to use?  I've tried deleting the content type but cannot (I get the following error: The last content type on a list cannot be deleted.Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: bcb50019-5830-42f3-bde6-9b0353b803e1 Date and Time: 10/4/2010 2:24:05 PM ).  If I could create a new calendar with only the fields i need that has the current view in it that would be great.  I cannot seem to get a new view to mimic the current view from the calendar webpart.  any ideas could be greatly appreciated.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend