Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQLPS (SQL Server 2012) Expand / Collapse
Author
Message
Posted Sunday, August 3, 2014 7:28 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:58 PM
Points: 20,871, Visits: 32,914
I am starting to learn (work) with PowerShell. On my work laptop I have installed SQL Server 2012 DE. Also using PowerShell 3.0 at the OS level. On our Windows Server 2008 systems we have installed PowerShell 4.0. The version of SQL Server installed on these servers is SQL Server 2008 R2 SE.

Here is the question.

Can I install the SQLPS module and supporting files from SQL Server 2012 on the Windows Server 2008 systems and use them at the OS level (PowerShell 4.0) to access work with our SQL Server 2008 R2 instances?

If I can, is there any thing I need to do to make it work? I have been searching to internet for answers and not finding much that really seems helpful. Some of seems to contradict itself at times.

At this time everything we are currently writing in PowerShell is external of SQL Server. I am not sure if we will be implementing anything in PowerShell inside of SQL Server.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1599040
Posted Monday, August 4, 2014 3:37 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 2,114, Visits: 3,720
Lynn Pettis (8/3/2014)

Can I install the SQLPS module and supporting files from SQL Server 2012 on the Windows Server 2008 systems and use them at the OS level (PowerShell 4.0) to access work with our SQL Server 2008 R2 instances?


Yep, that's exactly what I do. You should only need them on machines you're executing PS from.


If I can, is there any thing I need to do to make it work? I have been searching to internet for answers and not finding much that really seems helpful. Some of seems to contradict itself at times.


It doesn't help that there's 2 distinct things called SQLPS out there!
I add an import-module command to my Powershell profile, otherwise you'll need to load SQLPS manually every time you need it.

Edit: You might also need to add the module path to the PSModulePath OS environmental variable, but should work regardless if you give the full path to Import-Module
Post #1599171
Posted Monday, August 4, 2014 5:19 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 9:35 AM
Points: 2,114, Visits: 3,720
Oh, and check your execution setting with Get-ExecutionPolicy if you're running scripts - the default is Restricted which doesn't allow scripts to be executed, including any you've written yourself (you'll get an error message to that effect if you try).

You can change it using Set-ExecutionPolicy, usually to RemoteSigned but obviously choose whatever's most suitable for your environment.

Cheers
Post #1599201
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse