Invoke a video file from SQL Server using PowerShell

Rajnilari2015
Posted by in PowerShell category on for Beginner level | Points: 250 | Views : 697 red flag
Rating: 4 out of 5  
 1 vote(s)

In this article we will observe how to invoke a video file from SQL Server using PowerShell.

Introduction

While answering to a question in DotnetFunda Forum, we came upon this question which we found to be interesting not because of the fact that we have never done it before but because of the fact we felt it will be a new adventure for us to answer this (if at all it is possible!!!). And after we answered,we felt there is a need for an article in order to write down the process for this solution/approach.Here we are presenting our approach for the same.

Requirement

Suppose we have a video file in our hard disk. How can we run/execute that one from SQL Server Management Studio(SSMS)?

Solution

The approach we took is that we are invoking the video file from the PowerShell Script and invoking that PowerShell scriptlet from SQL Server Management Studio(SSMS).Below is a step by step guidance for the same.

Step 1

Consider that we have a video file located at "D:\songs\1.mp4".Open any text editor and let us write the following command.

 
Start-Process -FilePath "D:\songs\1.mp4"

The purpose of the Start-Process command is to start process(s) on the local computer. The -FilePath Parameter indicates the location of the program that runs in the process.

A detailed explanation about Start-Process is available here.

Save the file say in our case we saved at "D:\" with the file name as "RunVideo.ps1".

Step 2

Open SSMS with "Administrative Privilege"

Step 3

Open Object Explorer by clicking on View -> Object Explorer from ToolBar or by Pressing F8

Step 4

Right click on the SSMS instance and from the PopUP window, choose Start PowerShell

Click on Start PowerShell and we will receive the below window

Type the following command in the "SQL SERVER POWERSHELL" command prompt

PS SQLSERVER:\SQL\SAMDK13050003\DEFAULT+sa\>D:\RunVideo.ps1

Hit ENTER button and enjoy the hard work

Conclusion

In this article we have seen how to invoke a video file from SQL Server using PowerShell. We hope that the article will be useful as it shows the interaction of PowerShell with SSMS. Thanks for reading.

Page copy protected against web site content infringement by Copyscape

About the Author

Rajnilari2015
Full Name: Niladri Biswas (RNA Team)
Member Level: Platinum
Member Status: Member,MVP
Member Since: 3/17/2015 2:41:06 AM
Country: India
-- Thanks & Regards, RNA Team


Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)