Hi, i’m just looking for ideas on how to better utilize powershell to create a round-robin list to create home drives.
I was thinking about creating an array and then writing the array object number to a file as a tracker and then just grabbing the next number in the list.
Yes, if all you want to do is run it sequencially then all you need is the logging of the last number.
If I use Rob’s example of the shares variable.
You could just call each specific share/whatever-data-you-store by it’s index number.
Eg.
$shares[0]
Will get you “Server1”
If you replace the number with a variable.
Eg.
$shares[$n]
You would then call the share/folder/whatever information that is stored with that index number.
Replacing the content of $n wherever you are in the sequence.
If you really want balance, the best approach is determining the number of folders that exist in the share on each server. Using an index still assumes that no one or nothing else will create folders in the share location. It will take longer to execute, but it’s the best method to ensure balance.