Design
Hello, In a previous post I am using a shell script allowing me sending mailboxes statistics. I have the below report about the servers Disk space and I would need your help to "re-disign" my html file as I would like my report to look like the same as the below one. Please find my script below:
Company - Exchange 2007 Servers Disk Space
xxxxx01
Drive Label
Drive / Mount
Size (in GB)
Freespace (in GB)
Freespace Pcnt
OS
C:
12
2,77
23,07
LOGS
D:
55,64
48,63
87,4
QUEUE
E:
67,75
66,9
98,75
Last Updated: 21/12/2009 09:00:00
xxxxx02
Drive Label
Drive / Mount
Size (in GB)
Freespace (in GB)
Freespace Pcnt
OS
C:
12
2,46
20,47
LOGS
D:
55,64
49,45
88,89
QUEUE
E:
67,75
67,59
99,77
Last Updated: 21/12/2009 09:00:00
----------------------------- function SendMail($Recipient) { $SmtpClient = new-object system.net.mail.smtpClient $MailMessage = New-Object system.net.mail.mailmessage $SmtpClient.Host = "xxxxx.company.intra" $mailmessage.from = "admin@company.com " $mailmessage.To.add("$Recipient") $mailmessage.Subject = "[COMPANY] Mailbox Statistics - $date" $mailmessage.IsBodyHTML = $true $mailmessage.Body = $body #add attachment $mailattachment = new-object System.Net.Mail.Attachment($attachment) $mailmessage.attachments.add($mailattachment) $smtpclient.Send($mailmessage) }
$date = $(get-date).GetDateTimeFormats()[6]
$a = "<style>" $a = $a + "BODY{background-color:#FFFFFF;}" $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}" $a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:#E3CEF6}" $a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:#E3CEF6}" $a = $a + "</style>"
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ConvertTo-HTML -head $a -property DisplayName, lastlogontime, @{l="TotalItemSize(KB)";expression={$_.TotalItemSize.Value.ToKB()}},ItemCount | Out-File c:\scripts\mailboxes.htm
$Recipient = "graig@company.com " $body = $Statistics $attachment = "c:\scripts\mailboxes.htm" SendMail($Recipient)
#End
December 23rd, 2009 5:53pm
Wow. Now this needs CSS HTML coding. customizing $a block of the script-let. Need to create multiple CSS Templates and call them while converting output to HTML where required. Will try to do that. Thanks.
Vishal Ramnani MCITP - Exchange 2007, MCSE Messaging, MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
December 24th, 2009 9:26am
Hello,
Regarding the issue, I suggest you contact our CSS at: https://support.microsoft.com/oas/default.aspx?ln=en-us&x=18&y=14&c1=508&gprid=10926&&st=1
Or write the post in our development forum to see if someone can help:
http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads
Thanks,
Elvis
December 25th, 2009 10:05am
Hello Elvis,Sorry for not getting back to you sooner.. I was on holidays.I did follow your advice and post a new threat in the development forum.Many Thanks,Graig
Free Windows Admin Tool Kit Click here and download it now
January 7th, 2010 12:07pm