![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Re: Computernames from AD without curly braces ?? other options you can use: ## get all domain dc's $dom = [System.DirectoryServices.ActiveDirectory.Domain]::getcurrentdomain() $dom.DomainControllers | select Name ## this will get the all dc's in the forest (same as the next one below) ## $dom.forest.domains | select -expand DomainControllers | select name,domain ## get all forest dc's $forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() $forest.domains | select -expand domainControllers | select name,domain --- Shay Levy Windows PowerShell MVP blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic SL> Hi Dennis, SL> SL> $dclist | select -expand name SL> SL> --- SL> Shay Levy SL> Windows PowerShell MVP SL> blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic D>> Is there a way to get the computers names from an OU in AD without D>> the curly braces. I wrote this: D>> D>> $objADDCs = [adsi]"LDAP://OU=Domain D>> Controllers,DC=corp,DC=scwa,DC=com" D>> $dclist = $objADDCs.psbase.children D>> $array = @{} D>> foreach ($comp in $dclist) { $array.($comp.name) = D>> denping($comp.name)} D>> $array | ft D>> And it outputs this: D>> Name Value ---- D>> ----- {GRDC01} Alive D>> {PCDC01} Alive {ERODC01} D>> Alive {CRODC01} Alive D>> {HAUPDC01} Alive {OAKDC02} D>> Alive D>> D>> Is there a way to get the names without the quotes and without D>> trimming the value of the name? D>> |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tab expansion on path's with square braces is broken | Keith Hill [MVP] | PowerShell | 0 | 05-11-2007 11:46 PM |