Databases Reference
In-Depth Information
PowerShell can also be launched from SQL Server Management Studio by right-clicking on an object in
Object Explorer, as shown in Figure 11-3. SQL Server Management Studio launches the sqlps and sets
the location to the object to which you were pointing. In this case, it is the AWBuildVersion table in the
database AdventureWorks2008 (see Figure 11-4).
Figure 11-3
Figure 11-4
PowerShell scripts and cmdlets can also be launched inside a SQL Server Agent job. Figure 11-5 shows
that by setting the type of SQL Server Agent job step to PowerShell, you can insert PowerShell cmdlets
and scripts.
You can also launch Windows PowerShell and add the SQL Server PowerShell provider functionality
using the Add-PSSnapin cmdlet, as shown in Figure 11-6. In order to launch PowerShell in this way,
follow these steps:
1.
Launch Windows PowerShell from Start
Program
Windows PowerShell.
2.
Add the SQL Server PowerShell snap-ins as shown. In the following example, the cmdlet
Get-PSSnapin - registered shows all the available registered snap-ins in the system.
Search WWH ::




Custom Search