Sunday, September 28, 2014

Format Commands for PowerShell Output .

I was trying to get the list of timer jobs and their frequency in a table format using powershell. I searched technet and after reading through this  I figured it out.

I tried Get-SPTimerJob |Format-Table -Wrap   -AutoSize -property name,schedul
e,description,webapplication > D:\Timerjobs.txt.

Somehow the output text file showed only the name of the timerjobs with the following message

"WARNING: 3 columns do not fit into the display and were removed."

After a subtle thought I used the following command and got the results in a way I wanted.

Get-SPTimerJob |Format-Table -Wrap  -property name,schedul
e,description,webapplication > D:\Timerjobs.txt

Another interesting parameter you might want to use is ConvertTo-HTML , which will create a HTML report .

Get-SPTimerJob |ConvertTo-HTML -property name,schedul
e,description,webapplication > D:\Timerjobs.htm

Hope this helps you.

No comments:

Post a Comment