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 - how do i determine the OU structure on the fly ?

Reply
 
Old 4 Weeks Ago   #1 (permalink)
IT Staff


 
 

how do i determine the OU structure on the fly ?

Each time i script, i have to hard-code the OU. Is there a method to
determine the AD OU structure on the fly ?

Let me give a scenario:

# generic way to determine ANY ORGANISATION LDAP PATH
$objOU=[ADSI]"LDAP://ROOTDSE"
$OBJOU.defaultNamingContext


Is there similar way like above to determine OU structure ?





My System SpecsSystem Spec
Old 4 Weeks Ago   #2 (permalink)
Martin Zugec


 
 

Re: how do i determine the OU structure on the fly ?

On Nov 6, 3:43*am, "IT Staff" <jkk...@newsgroup> wrote:
Quote:

> Each time i script, i have to hard-code the OU. Is there a method to
> determine the AD OU structure on the fly ?
>
> Let me give a scenario:
>
> # generic way to determine ANY ORGANISATION LDAP PATH
> $objOU=[ADSI]"LDAP://ROOTDSE"
> $OBJOU.defaultNamingContext
>
> Is there similar way like above to determine OU structure ?
Sorry, could you be more specific??

"Determine the AD OU structure" - of which OU exactly, how?

Martin
My System SpecsSystem Spec
Old 4 Weeks Ago   #3 (permalink)
IT STAFF


 
 

Re: how do i determine the OU structure on the fly ?

Let me be more specific.

In company A, their OU structure could be like this:

OU Country1
OU Computers
OU Users.

In company B, their OU structure could be like this:

OU Dept1
OU Users_Computers

If i write a script for Company A, i hAve to use a regular expression to
detect Company A OU structure.
Similarly if i write a script for Company B, the regular expression used in
Company A cannot be applied to Company B. This means i have to write a
regular expression for Company B.

Is there a "generic" way to determine the OU structure of Two companies,
rather than *hard code" a regular express for Company A and Company B
respectively ?





My System SpecsSystem Spec
Old 3 Weeks Ago   #4 (permalink)
Martin Zugec


 
 

Re: how do i determine the OU structure on the fly ?

Still don't know what exactly you want to achieve - OUs are container
objects for OU, therefore you will need to do equivalent of Get-ChildItem
(which can be done) and then have some logic to determine which OU is used
for what - and this is suddenly almost impossible task

You could of course have a logic that will match OU based on some kind of
mask (for example returning first OU that contains work Users or Computers),
however don't think such code would be too useful.

Martin

"IT STAFF" <jkklim@newsgroup> wrote in message
news:ep7915uXKHA.3448@newsgroup
Quote:

> Let me be more specific.
>
> In company A, their OU structure could be like this:
>
> OU Country1
> OU Computers
> OU Users.
>
> In company B, their OU structure could be like this:
>
> OU Dept1
> OU Users_Computers
>
> If i write a script for Company A, i hAve to use a regular expression to
> detect Company A OU structure.
> Similarly if i write a script for Company B, the regular expression used
> in Company A cannot be applied to Company B. This means i have to write a
> regular expression for Company B.
>
> Is there a "generic" way to determine the OU structure of Two companies,
> rather than *hard code" a regular express for Company A and Company B
> respectively ?
>
>
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
ntfs fle structure Vista file management
Generic regular expression to determine the OU structure PowerShell
ASP.Net directory structure .NET General
folder structure?? Vista file management
Old Disc structure. Vista installation & setup


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