How Can We Help?
< Back
You are here:

Use lookup tables

Often you will need to look up values. To avoid to have to do this in each run through the loop, it often improves the execution time of your script, if you lookup those values once before the loop and store them in a hash table.

This snippet uses a Get-Datastore for each harddisk to find the canonicalname of a datastore.

The following snippet uses a hash table to translate the datastorename into a canonicalname.


Next Limit cmdlet calls in a loop

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Table of Contents