Is there a PowerShell command that will execute a backup of all databases on a server?
Alternatively, can I call a stored proc from PowerShell (that will execute the backup)?
Is there a PowerShell command that will execute a backup of all databases on a server?
Alternatively, can I call a stored proc from PowerShell (that will execute the backup)?
if you are running sql server 2008 you have powershell bindings. See this link
SQL Server 2008 powershell has a cmdlet invoke-sqlcmd.
It is possible, there are some pre-requisites you need to have installed (namely the Microsoft SQL Server 2005 Management Objects Collection) and theres quite alot of powersehll code needed to do it, however there are a number of articles out there that have it allready done for you. I have used this method successfully in the past.
You can use ADO.NET from PowerShell to execute a stored proc..
See this example.
There's functions for PowerShell-based SQL Server database backups included in the CodePlex project SQL Server PowerShell Extensions (SQLPSX). Take look at Invoke-SqlBackup or if you want to implement a full backup and maintenance routine take a look at the SQLMaint module.