By: Charley Hanania | Updated: 2009-07-14 | Comments | PowerShell
OK, first things first...
I have SQL Server 2008 installed locally (developer edition) on Vista, which I believe installs Powershell for you as a component... I'm using V1.0.
The easiest way to see if its installed it to use the "run" command and type powershell...
If its not installed, read this article How to Download Windows PowerShell 1.0.
Once that's done, you need to set up your environment.
I would encourage you to install Marc's "Tab Completion" Tool for Powershell, which does exactly what you would expect...
You may get an error as I did when running the cmd file, and what I had to do to fix this was:
From the Powershell Prompt type: Set-ExecutionPolicy Unrestricted
Then you can run the setup cmd file again and walk through the set up steps...
Next step is to load the SQL Server libraries so that Powershell can use them...
From Powershell Prompt type:
To see what's loaded:
Now this will be forgotten when the powershell session closes, so add those 2 lines to the default profile:
(ii instansiates an object - like typing start [program name] from cmd prompt)
If you type $PROFILE on its own, it tells the path and name of the profile file.
If the add-snapin command errors, then you may need to install the SQL Server Powershell Providers from the Feature Pack and retry.
Next step... querying your SQL Server...
Last Updated: 2009-07-14
About the author
View all my tips