SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQLPS (SQL Server 2012)


SQLPS (SQL Server 2012)

Author
Message
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41092 Visits: 38567
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.

Cool
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)
Gazareth
Gazareth
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4118 Visits: 5843
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
Gazareth
Gazareth
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4118 Visits: 5843
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search