PS Hash Tables add Data in random position

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!!!

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.
Cheers

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