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.
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