Powershell in SQL Serverhttps://sqldatapartners.com/wp-content/themes/crocal/images/empty/thumbnail.jpg150150Carlos L ChaconCarlos L Chaconhttps://secure.gravatar.com/avatar/5e3365b6a313f63d0ad1fd6748a46345?s=96&d=mm&r=g
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.
SQL Data Partners has been acquired by Marathon Consulting, a Virginia-based Information Technology Consulting and Digital Marketing firm. We are in the process of integrating our team and services into Marathon as of May, 2023.