Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Access a different forest

Reply
 
Old 07-04-2006   #1 (permalink)


 
 

Access a different forest

I was interested to find out about accessing my domain's Directory Services through the New-Object System.DirectoryServices.DirectoryEntry method, but how would I access another forest to which I have access permissions?

My System SpecsSystem Spec
Old 07-06-2006   #2 (permalink)
Jim Holbach


 
 

RE: Access a different forest

It depends on what you want to do. If you just want to access the AD users,
computers, etc in a domain inside another forest, you can just use the
System.DirectoryServices.DirectoryEntry object specifying the LDAP path for
the domain that you want to work with. For example,

$Entry = New-Object
System.DirectoryServices.DirectoryEntry("LDAP://dc=otherdomain,dc=com")

$Entry = New-Object
System.DirectoryServices.DirectoryEntry("LDAP://dc=childomain,dc=rootdomain,dc=com")

If you want to explore the structure of the other forest, you'll want to use
the System.DirectoryServices.ActiveDirectory namespace, starting with

$Forest =
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()

or

$ForestContext = New-Object
System.DirectoryServices.ActiveDirectory.DirectoryContext("Forest",
"otherdomain.com")
$OtherForest =
[System.DirectoryServices.ActiveDirectory.Forest]::GetForest($ForestContext)

If you need to specify alternate credentials to access the forest, the
DirectoryContext constructor allows you to do that also.


"sluice" wrote:

>
> I was interested to find out about accessing my domain's Directory
> Services through the New-Object System.DirectoryServices.DirectoryEntry
> method, but how would I access another forest to which I have access
> permissions?
>
>
> --
> sluice
> ------------------------------------------------------------------------
> sluice's Profile: http://vista64.net/forums/member.php?userid=119
> View this thread: http://vista64.net/forums/showthread.php?t=9580
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
search AD in separate forest VB Script
Get username/group membership from another forest? VB Script
SCVMM P2V in different forest Virtual Server
Trust Between Forest Virtual Server
List all DCs in the forest PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46