Powershell in SQL Server

Powershell in SQL Server

Powershell in SQL Server 150 150 Carlos L Chacon

I have yet to really scratch the surface in using Powershell to manage my SQL Server; however, from time to time I have used a powershell script to delete files from the server on an ongoing process.  Because I am still a Powershell novice, I get most of my scripts from the Scripting Guy.  He does a good job explaining what the variables do and mean and I invite you to check that post out.

This example is in SQL Server 2008.  Putting into SQL Server Agent is fairly straightforward.  I choose a new step and choose a Type of Powershell.  This script will delete all the files in my D:Backups folder that are older that 5 days.

Imagine what’s possible with a dedicated SQL specialist on your team.

Leave a Reply

Back to top