-1

How do you send the dbachecks output to a file on disk?

I tried the following but it resulted with the output on screen and a 0 kb file on disk.

Invoke-DbcCheck -Check Database -SqlInstance myserver -ExcludeCheck TestLastBackup, TestLastBackupVerifyOnly | Out-File c:\myserver.txt
Vérace
  • 30,923
  • 9
  • 73
  • 85
user2368632
  • 1,133
  • 1
  • 15
  • 33

1 Answers1

2

You need to add the parameter

-PassThru

As per the documentation:

By default, Invoke-DbcCheck writes to the host program, not to the output stream (stdout). If you try to save the result in a variable, the variable is empty unless you use the PassThru parameter.

Zikato
  • 5,619
  • 1
  • 17
  • 34