Quantcast
Channel: Questions in topic: "sql-agent"
Viewing all articles
Browse latest Browse all 80

PowerShell versions in SQL Server Agent 2008 R2 - How to upgrade from V1.0 to higher versions

$
0
0
I have question about using PowerShell in SQL Server Agent on SQL Server 2008 R2. * What circumstances would lead to only having PowerShell V1.0 available in SQL Server Agent task steps (even when launching PowerShell.exe from a cmdexec step), and how can I get more advanced versions? Googling has revealed to me that the sqlps "mini-shell" used by the PowerShell steps in SQL Agent typically returns a version of 2, but is very constrained in terms of the cmdlets actually available to it. Therefore, it is common to launch new PowerShell.exe processes to get access to either v2.0 or v3.0 functionality. However, when I schedule steps that launch PowerShell in SQL Agent, the shell appears to be version 1. I am beginning to suspect that this server only HAS version 1 installed (originally, I was mislead by launching the SQLPS shell from within SSMS on my workstation and finding version 3.0 available when I would launch PowerShell.exe within the sqlps console - I am reasonably sure that process was launched from my workstation, not whatever is available server side). Working through this question, I think the answer might be that I need to talk to the sysadmin about updating either the operating system (I think that version number indicates the OS is Windows Server 2003) or install PowerShell V3.0 (or maybe both). Does anyone have any cautionary tales about upgrading PowerShell and SQL Agent? Do we need to uninstall PowerShell V1.0? Will SQL Server Agent be able to pick up the new version of PowerShell without trouble? Addendum - Version info: From a PowerShell script run in SQL Agent, using an operating system task (CMDEXEC), which launched powershell.exe and returned $Host.Version information: Major Minor Build Revision ----- ----- ----- -------- 1 0 0 0 The server version: SELECT @@Version Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) Jun 28 2012 08:36:30 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2) (Hypervisor)

Viewing all articles
Browse latest Browse all 80

Trending Articles