Now that I’ve been using PowerShell for a while, I’ve found that as I remote onto different servers I’m having to use the Add-PSSnapIn commandlet and remember the various names of snap-ins that I want to use. Because I’m always looking for shortcuts along the way I’ve found this little gem that I can put in the profile.ps1 file to effectively load all snap-in modules that are on the server:
get-pssnapin -registered | add-pssnapin –passthru
This can be added to individual servers profile.ps1 files, but that will affect all users who remote into the server as well. Since I’ve got a network My Documents, I can place the script inside the “My Documents\WindowsPowerShell\profile.ps1” file and now for any server I remote into, when I open the PowerShell app it will load all of the registered Snap-in modules on that server. The file can be further customized with colors and other preferences.