Yes, the columns line up in the text file that you redirect it to, but if I
then send that file as the body of an e-mail, the formating is shot.
Thanks
--
Merkel-DBA
"Keith Hill" wrote:
> "Stephen Merkel" <StephenMerkel@discussions.microsoft.com> wrote in message
> news:0D176EB7-0471-4C72-9A86-BFFC0D58E32F@microsoft.com...
> > My script uses format-table as follows:
> > Format-Table @{Label="Disk Drive"; Expression={$_.DeviceID+'\'}},`
> > @{Label="Size(GB)"; Expression={[math]::round$_.size/1024/1024/1024,2)}},`
> > @{Label="Free(GB)";
> > Expression={[math]::round$_.freespace/1024/1024/1024,2)}}` -a
> >
> > I can redirect this output to a .txt file and send the file as an
> > attachment.
> > When I atttempt to use this file as the e-mail body, all the formating
> > (columns) are lost and the message appears as one long string.
> > I am hoping there is a way to capture the output from the format-table in
> > such a way that it can be used as the e-mail body.
> > Thanks in advance....
>
> Hmm, when I execute:
>
> gwmi Win32_LogicalDisk |
> Format-Table @{Label="Disk Drive"; Expression={$_.DeviceID+'\'}},
> @{Label="Size(GB)"; Expression={[math]::round($_.size/1GB,2)}},
> @{Label="Free(GB)";
> Expression={[math]::round($_.freespace/1GB,2)}} -a
>
> and redirect it to foo.txt I get multiple lines and as long as I use a fixed
> pitch font, all the columns line up. BTW you don't have to repeatedly
> divide by 1024 to get to GB units. Just divide by 1GB. There's also MB and
> KB available.
>
> --
> Keith
>