You are doing an incredible job. Thank you for your help. I do want to pull this information from a DMV.
Code: Select all
$SQLQuery = "SELECT Session_id as SPID, Command , query.text AS 'Query Text', Start_Time, Percent_Complete, dateadd(second,total_elapsed_time/1000, getdate()) as 'Total Elapsed Time',
dateadd(second,estimated_completion_time/1000, getdate()) as 'Estimated Completion Time'
FROM sys.dm_exec_requests request CROSS APPLY sys.dm_exec_sql_text(request.sql_handle) query
WHERE request.command in ('BACKUP DATABASE') and query.text like '%WITH name=%$BackupSetName'"
The PowerShell Code I do have works, but I need to figure out two things, which I could not yet achive:
1. How to run two jobs simultaneously. Examples for this are suprisingly hard to find The SQL Query job needs a param $BackupSetNamecould so it returns the percentage of the correct backup job.
2. Display the result (percent) of the SQL Query in the richtextbox (or a progress bar) or whatever.
I figure
Code: Select all
$result= $results = Receive-Job -Job $Job -Keep| Select Percent_Complete