Author Posts

January 30, 2017 at 4:14 pm

Hi folks,

I'm sure this is an easy thing to sort out..

So here is a sample of my code:

#Query the dashboard on netapp filer and return result
$gather_dashboard =
write-host "* Alarm Dashboard *"
(Get-NcDashboardAlarm | format-table -AutoSize)

#run the gather variables and output to output.txt
$today = Get-Date
$dir = "$data_dir_date\output.txt"
Add-content $dir "Netapp health Checks for $filer1, $today"
*****here i want to write the output of $gather_dashboard into the text file $dir, then create a new line in text file and do the same thing with a different variable*****

SO what i am trying to achieve is a log of the ouput of each variable of which there are 6 or 7. There would have to be 3 lines between each output, and each output has a relevant title inserted.

Currently anything i do overwrites the text file with each variable or just produces nothing.

What do I need to do?

January 30, 2017 at 4:35 pm

Please try below:

$today = Get-Date
$dir = "$data_dir_date\output.txt"
"Netapp health Checks for $filer1, $today" | Out-File -FilePath $dir -Append