Technical Article

Capture the tasks performed in a text file

,

Open Powershell in admin mode

Copy the entire script

Run it.

Note: You must have powershell 3.0 to avail Start-Transcript cmdlet.

Ensure that in your script, you have the proper database context mentioned.

$filename = Get-Date -format "yyyyMMdd"
$filename
$path = "C:\PS_output_transcript\" + $filename +".txt"
$path
start-transcript $path -append 

write-host "test"

$Server = "Your SQL Instance" #change the details accordingly.
$error.Clear()

invoke-sqlcmd -ServerInstance $Server -InputFile "C:\filename.sql"-verbose  -ErrorAction Stop

stop-transcript

Rate

4 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

4 (2)

You rated this post out of 5. Change rating