The Surly Admin

Father, husband, IT Pro, cancer survivor

Of Mistakes and Modules

Recently I’ve been doing more with Powershell functions, and blissfully telling people to run the script and then the function is available to you.  This is great if you use a Powershell ISE, either the built in one or a third-party one like PowerGUI.  ISE’s will keep functions alive after you’ve run your script, which is a great feature while you’re testing a new script.  The shell, on the other hand, isn’t so forgiving.  Run it there and it loads into memory and as soon as the script finishes it promptly is DUMPED from memory.

Oops, sorry about that!

Continue reading

Advertisements

September 9, 2012 Posted by | General, PowerShell, Random Thoughts, Technical | , , | 1 Comment

Restart-Computers with Firm Confirmation

I’m always on the look out for new PowerShell projects.  Doesn’t much matter if they’re little projects–like this one–or big ones–like The DFS Monitor With History.  This is why I’m always on the Spiceworks IT Programming forums and PowerGui.org’s forums.

Today I ran across a little script someone was writing in batch and I decided to write it in PowerShell for a couple of reasons.  I had not really played with the Read-Host functionality yet and I wanted to play with the built-in documentation functionality of PowerShell which I discovered while on vacation.  Yes, I read PowerShell stuff while on vacation, it’s a weakness (so far I’ve been able to hold off on the PowerShell reference app for the iPad, but not sure how much longer)!!

Continue reading

August 28, 2012 Posted by | PowerShell | , , , , , | 2 Comments