MyTechMantra.com
Connect With MyTechMantra.com

Like Us on Facebook    Follow Us on Twitter     Subscribe to our Feeds     Subscribe to NewsLetter
































How to Identify Version of PowerShell Installed on Server Using TSQL Script

Read Comments


Introduction

More and more DBAs are now move towards using PowerShell to perform routine Database Maintenance Tasks on SQL Server. In this article we will go through the quick steps to determine which version of PowerShell is installed on the Server where SQL Server is hosted using TSQL Script.

TSQL Script to Identify Version of PowerShell Installed on SQL Server Host Machine

Execute the below mentioned TSQL script to identify version of PowerShell which is installed on SQL Server using xp_regread undocumented extended stored procedure.

EXEC	master.dbo.xp_regread
	@rootkey= N'HKEY_LOCAL_MACHINE',
	@key= N'SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine',
	@value_name= N'PowerShellVersion'
GO
How to Find Poweshell Version on SQL Server Using TSQL

Identify Version of PowerShell Installed on SQL Server Host Machine Using PowerShell

Lets verify the version of PowerShell Installed on SQL Server using SQL Server PowerShell.

1. Connect to SQL Server Instance Using SQL Server Management Studio
2. Right Click SQL Server Instance and then choose "Start PowerShell" as shown in the below snippet.


How to Start Powershell from SQL Server Management Studio

3. Once SQL Server PowerShell opens up type $PSVersionTable.PSVersion and press enter to get the results.

Identify Powershell Version Using SQL Server Management Studio

4. Finally type Exit to close the PowerShell window.


Next Steps:




Last Updated On: Aug 10, 2015



Share this Article



Receive Free SQL Server Tips and Keep Learning
Get Free SQL Server Tips




Please leave your Valuable Comment or Let us know how this article helped you: