PowerShell: putting globally scoped values in a module?
I have multiple scripts that utilize functions that are in a module (psm1). I also have common values (file paths/names) that are currently in global hashtables in the module. MS is now discouraging global objects so I am trying to find a way to include my values in the module and not use another file (XML, CSV, etc.) and not put them in each script. When things change (and they will) I want to simply update in one location – my module.
Powershell – Replace manufacturer name from the initial 3 letters to full name using a hashtable
I have the following script that creates a new class in the WMI called MonitorDetails which collects data from the registry for each monitor connected to a computer.
Hash Table – Sort in order of how they are input
I have a hash table here and I have it eventually outputting to an Excel spreadsheet, but the issue appears to be the way the system sorts the hash table by default. I want it to return the machines in the same order that they are inputted, they way it currently works is a box pops up and you paste in all your machine names so they are all in memory prior to the foreach
loop. I was previously sorting this by the longest uptime but it now needs to be the same way they are inputted. My initial thought is to create another hash table and capture them in the same order versus the $machineList
variable, but that might even leave me in the same position. I tried to search but I couldn’t find info on the default way that hash tables sort.