I've just been looking at the PowerShell support and it looks interesting if a little limited - as has been stated in
Dmitry’s PowerBlog.
You invoke PowerShell from SQL Server Management Studio by right clicking on a node in the tree and choosing 'Start PowerShell'. This runs 'SQLPS.exe' and starts the shell. One thing that caught me was that the resulting shell has some standard cmdlets missing. Add-PSSnapin, Get-PSSnapin, Remove-PSSnapin and Export-Console seem to have gone AWOL.
SQL Books Online states that the SQL snapins are
- Microsoft.SqlServer.Management.PSProvider.dll
- Microsoft.SqlServer.Management.PSSnapin.dll
As these are just regular snapins you can load them into the standard PowerShell host as follows -
First register the snapins using the .Net utility installutil with the commands
set-alias installutil $env:windir\Microsoft.NET\Framework\v2.0.50727\installutil
cd "c:\Program Files\Microsoft SQL Server\100\Tools\Binn"
installutil Microsoft.SqlServer.Management.PSProvider.dll
installutil Microsoft.SqlServer.Management.PSSnapins.dll
and check that everything is OK
Then load the snapins
and voila SQL support is enabled
Don't forget to remove and unregister (installutil /u) the snapins when you want to remove the CTP.