header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Convert Array into String (dynamic variable)
Last Post 17 Jan 2012 12:45 PM by kmark. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
link1277User is Offline
New Member
New Member
Posts:11
Avatar

--
17 Jan 2012 05:33 AM
    I'm trying to add our AD sites into an array property (if I'm saying that right).  Value's in a { }.

    I'm trying to do the following in Exchange 2010

    $a = get-adsite | select name  ( I would like to get the list here, into an array with the following format, "adsite1","adsite2","adsite3"

    set-clientaccessserver -identity server01 -autodiscoversitescope $a

    Because the -autodiscoversitescope values are in  { } brackets on the last one applies if you foreach.  Any ideas here?

    Thanks
    kmarkUser is Offline
    New Member
    New Member
    Posts:4
    Avatar

    --
    17 Jan 2012 12:45 PM
    Sounds like it's storing the data in $a as a hashtable

    Here are a bouple links that have some good information.
    http://stackoverflow.com/questions/...reach-loop
    http://powershell.com/cs/blogs/eboo...ables.aspx

    Once you know how the hash table is holding the values you can loop through them

    I hope that helps.

     $myHash = @{}
    $myHash["a"] = 1
    $myHash["b"] = 2
    $myHash["c"] = 3
    
    foreach($key in $myHash.keys){
        $myHash[$key] = 5
    }
    Kevin Markwardt
    http://www.kevinmarkwardt.com
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer