header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Deleting classRegistration object with alternate credentials using PowerShell
Last Post 02 Jul 2010 04:04 AM by br4tt3. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
br4tt3User is Offline
New Member
New Member
Posts:1
Avatar

--
02 Jul 2010 04:04 AM

    Hi folks, I have been surfing the web now for almost two days, driving me nuts as I just cant seem to find the answer to my question. So, here I am asking you guys for a breaktrough:

    Problem: I want to delete a classRegistration object in Active Directory using PowerShell using alternate credentials!

    Below is my code right now;
    ----------------------------
    $strShortDomainName = "corporate_domain_name"
    $VSC_DeleteCachedClusterObject = "LDAP://CN=ObjectToDelete,cn=Lastval...ame,DC=com"

    $VSC_DeleteCachedAliasDomainObject = New-Object DirectoryServices.DirectoryEntry ($VSC_DeleteCachedClusterObject),($strShortDomainName + "\MyCustomUserAccount"),"MyCustomPassword"
    $VSC_DeleteCachedAliasDomainObject = New-Object DirectoryServices.DirectoryEntry ($VSC_DeleteCachedClusterObject)

    $VSC_DeleteCachedAliasDomainObject.psbase.authenticationtype = [System.DirectoryServices.AuthenticationTypes]::FastBind
    $VSC_DeleteCachedAliasDomainObject.DeleteObject(0)
    $VSC_DeleteCachedAliasDomainObject.SetInfo()

    ----------------------------
    Running the code as a more elevated user from the POSH will execute code correctly and delete the object which indicates a permission problem for the "MyCustomUserAccount". However, opening the adsiedit.msc under the context of the "MyCustomUserAccount" will allow me to delete the object which brings me back to square one!

    Another question: If you dont connect / bind to the object using the New-Object DirectoryServices.DirectoryEntry way, rather using the [ADSI] provider, can you connect / bind using this method with alternate credentials? I've been looking but could not find anything.

    Again, looking for help here! Thanks in advance!


    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer