Setting Up Your Old Powershell on a New Windows Install

Let me start off by saying “when setting up your PowerShell in a new OS environment, be sure to load your assemblies first otherwise you may not see ANY commands in the command viewer”.

This is just an FYI for anyone who does a “clean” install of Windows 10 and then wants to set up their PowerShell similar to what they had.

I use PowerShell with SQL Server almost exclusively. My environment had a profile, a module of frequently used functions for SQL Server, and a folder with numerous POSH scripts which was included in my path.

After installing Windows 10, I fired up PowerShell ISE and found it to be working perfectly. After adding my module folder to the PsModulePath and adding my scripts folder to the Path, I found I could no longer view ANY commands in the ISE command viewer! Working backwards, I took my scripts library out of the Path and restarted the ISE. Lo and behold, the command viewer now showed the commands again.  After adding my scripts folder back to the path, command viewer would not display any commands.

I decided to load my SQL Server assemblies, performed a refresh on command viewer and made some progress. Now an error message popped up regarding an error in one of my scripts (in the path). After correcting several script errors, all available commands now showed up in command viewer.

I restarted PowerShell and the commands were no longer viewable again. I then added the loading of my SQL Assemblies into a profile and after restarting, all commands were once again visible in command viewer.

It would appear that the new PowerShell does some type of error checking for scripts in your path and if the scripts reference assemblies not loaded, it breaks down with regard to Command Viewer.

Leave a Reply