Working with the sample code
Samples in this book have been created and tested against SQL Server 2012 on Windows Server 2008 R2.
Note
To work with the sample code in this book using a similar VM setup that the book uses, see Appendix D, Creating a SQL Server VM.
How to do it...
If you want to use your current machine without creating a separate VM, as illustrated in Appendix D, Creating a SQL Server VM, follow these steps to prepare your machine:
Install SQL Server 2012 on your current operating system—either Windows 7 or Windows Server 2008 R2. See the list of upported operating systems for SQL Server 2012:
Install PowerShell V3.
Although PowerShell V3 comes installed with Windows 8 and Windows Server 2012, at the time of writing this book these two operating systems are not listed in the list of operating systems that SQL Server 2012 supports.
To install PowerShell V3 on Windows 7 SP1, Windows Server 2008 SP2, or Windows Server 2008 R2 SP1:
Install Microsoft .NET Framework 4.0, if it's not already there.
Download and install Windows Management Framework 3.0, which contains PowerShell V3. At the time of writing this book, the Release Candidate (RC) is available from:
http://www.microsoft.com/en-us/download/details.aspx?id=29939
Enable PowerShell V3 ISE. We will be using the improved Integrated Scripting Environment in many samples in this book:
Right-click on Windows PowerShell on your taskbar and choose Run as Administrator.
Execute the following:
PS C:\Users\Administrator>Import-Module ServerManager PS C:\Users\Administrator>Add-WindowsFeature PowerShell-ISE
Test to ensure you can see and launch the ISE:
PS C:\Users\Administrator> powershell_ise
Alternatively you can go to Start | All Programs | Accessories | Windows PowerShell | Windows PowerShell ISE.
Set execution policy to
RemoteSigned
by executing the following, on the code editor:Set-ExecutionPolicy RemoteSigned
Note
If you want to run PowerShell V2 and V3 side by side, you can check out Jeffery Hicks' article, PowerShell 2 and 3, Side by Side:
http://mcpmag.com/articles/2011/12/20/powershell-2-and-3-side-by-side.aspx
See also
Check out the PowerShell V3 Sneak Peek Screencast:
See also the SQL Server PowerShell documentation on MSDN:
http://msdn.microsoft.com/en-us/library/hh245198(SQL.110).aspx