Useful Powershell functions and snippets that I don't want to have to rewrite anymore. If you come across this and want to use it, go ahead. There is a BSD- style license below to satisfy any lawyers that might bug you.
I make no claim that all of this code is original with me. I'm sure much of it came about by borrowing and customizing whatever I've found lying about on the Internet. I suppose any original code is copyrighted to me.
The code is written as modules that are meant to be imported.
Import-Module .\mod.psm1 -Force
Or, sometimes this works better because of nesting:
Import-Module .\general.psm1 -Force -NoClobber -Scope Global
It is usually a good idea to remove it at the end of your script.
Remove-Module mod
Copyright (c) 2013, Daniel F. Peterson. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted. No attribution is required.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.