DirectoryServices.DirectoryEntry Class member confusion...


bear me here...

to create new objects using adsi, can run following snippet:

  $objou = [adsi]"ldap://ou=myou,dc=domain,dc=com"  $objgroup = $objou.create("group", "cn=my new group")  $objgroup.put("samaccountname", "my new group")  $objgroup.setinfo()    

this creates new security group in ou. now, both $objou , $objgroup objects of type directoryentry.

  $objou.gettype().fullname    

and if members of these directoryentry objects, not see create, put or setinfo methods @ all...

  $objou | get-member -view    

==> so, question - why snippet work? create, put, , setinfo methods coming from? aren't documented under .net framework references directoryentry class...

http://msdn.microsoft.com/en-us/library/system.directoryservices.directoryentry.aspx

 

hi,

to more information $objou, please try:

$objou.psbase | gm

powershell doesn’t implement iadscontainer directly. powershell uses wrapper .net objects classes, example wmi,adsi , xml objects.

for reference:
http://mow001.blogspot.com/2006/09/powershell-rc2-and-active-directory.html
please note: since web site not hosted microsoft, link may change without notice. microsoft not guarantee accuracy of information.

thanks.


this posting provided "as is" no warranties, , confers no rights. please remember click "mark answer" on post helps you, , click "unmark answer" if marked post not answer question. can beneficial other community members reading thread.


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Generating Event ID 91, 44 with CA (In Event Viewer with source as Certsvc)

Group policy default policy cannot be edited because network name not found

Windows server 2012 r2 inplace upgrade failed