PS Hash Tables add Data in random position

This topic contains 2 replies, has 2 voices, and was last updated by  CHARALABOS 3 years ago.

  • Author
  • #26414


    Hello community

    I put data in a hash table (using add method) but the order is very important for my task.
    By getting the contents from the hash table the order changes.
    I'm wondering what I'm doing wrong and how I can get my data from the hashtable in the correct order.

    thank you all in advance!!!

  • #26416

    Flynn Bundy

    Hi Mate,

    If you are using PowerShell version 3.0 or later. you should be able to declare your hash table like this:

    $hash = [ordered]@{ }

    This should make the contents display as you laid them out in the script.

    Let me know how you go.

  • #26417


    IT WORKED !!! thank you very much!!!

You must be logged in to reply to this topic.