Thursday, June 12, 2008

Add-pssnapin for Powershell Tools


When Powershelling make sure you install any applicable snapin BEFORE you run the script otherwise you will get nothing. Here is a good way to Prefix your code

if (get-pssnapin | where {$_.Name -eq "PowerGadgets"})
{}

else
{add-pssnapin "PowerGadgets"}

you can also use the line

add-pssnapin Quest*

if you are lazy like me instead of typeing
add-pssnapin Quest.ActiveRoles.ADManagement

Message for Chris, For some reason it wont let me post your response, please email me at WALL and then the @ sign then my domain MURMANS dot Com