Posts

Showing posts with the label Advice

Speeding Up your PowerCLI Scripts

So, I post a lot of scripts here, and I'm sure that you can see the progress that I've made as I've learnt more and more about PowerCLI, PowerShell and scripting in general.  One of the things that I've recently been considering is how to make my scripts run faster.  I've got some scripts that are designed to make lots of changes, like changing the Port Group assignment of every VM in an environment.  And they take a long time to run.  As in, depending on the size of the environment, several hours.  But, they don't necessarily have to take so long to run... I just wasn't clever enough when I wrote them. There are two major techniques that I'm trying to learn that would seriously speed up those scripts.  The first one is parallel execution of For Each loops... I'm still learning about that one, so will write more about it once I've learnt something worth sharing.  The other though, is much easier, and can generally be worked into any script with...