TechOnTip Weblog

Run book for Technocrats

Get child objects thru ADSI & Powershell

Posted by Brajesh Panda on January 3, 2017

For example exchange org details..

$ForestRootDSE= (Get-ADRootDSE).rootDomainNamingContext

$config = [ADSI]"LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,$ForestRootDSE"

$orgName = $config.psbase.children | where {$_.objectClass -eq ‘msExchOrganizationContainer’}

$orgName.name

$orgName.objectVersion

I have to understand little more about psbase. Seems like more methods are available under psbase ($config.psbase | gm) & mostly used with ADSI, WMI or XML kind of stuff. Folks says; PSBase lets you get at the “raw” object behind the object PowerShell exposes by default; in other words, PSBase lets you get at all the properties and methods of the object.

https://blogs.technet.microsoft.com/heyscriptingguy/2008/03/12/hey-scripting-guy-how-can-i-use-windows-powershell-to-add-a-domain-user-to-a-local-group/

https://blogs.msdn.microsoft.com/powershell/2006/11/24/whats-up-with-psbase-psextended-psadapted-and-psobject/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: