MVP - Most Valuable Professional
rss

Just can't get enough of IT

This blog is about mostly anything in IT. But the primary focuses are Microsoft Technologies like Exchange, Office 365, Azure and Cloud Security.
On April 22, 2016
0 Comment
4976 Views

The PowerShell script Get-Diskspace.ps1 uses a pretty basic inline CSS approach to generate a more nicely html email from a PowerShell output.

You can use the following description for your own PowerShell script.

First a new html block is configured and the inline CSS is embedded into the head tag.

# Some CSS to get a pretty report
# Variable containing the inline CSS and the full html head tag
$head = @'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html><head><title>$($ReportTitle)</title>
<style type=”text/css”>
<!–
body {
    font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
}
h2{ clear: both; font-size: 100%;color:#354B5E; }
h3{
    clear: both;
    font-size: 75%;
    margin-left: 20px;
    margin-top: 30px;
    color:#475F77;
}
table{
    border-collapse: collapse;
    border: none;
    font: 10pt Verdana, Geneva, Arial, Helvetica, sans-serif;
    color: black;
    margin-bottom: 10px;
}
 
table td{
    font-size: 12px;
    padding-left: 0px;
    padding-right: 20px;
    text-align: left;
}
 
table th {
    font-size: 12px;
    font-weight: bold;
    padding-left: 0px;
    padding-right: 20px;
    text-align: left;
}
->
</style>
'@

The recurring data content is added to a global varibale using the -Fragment attribute. This ensures that no full html document data is being created.

$global:Html += $wmi | ConvertTo-Html -Fragment -PreContent "<h2>Server $($ServerName)</h2>"

Before sending the html result the full body html is generated by combinding the html fragments and the manually defined html head.

[string]$Body = ConvertTo-Html -Body $global:Html -Title "Status" -Head $head

Send-Mail -From $MailFrom -To $MailTo -SmtpServer $MailServer -MessageBody $Body -Subject $ReportTitle  

Enjoy.

Read More »

The new community script Get-Diskspace helps to fetch disk volume information from a single server or across multiple servers.

Currently the script supports a command line switch to gather disk volume information across all Exchange servers in your environment.

The following screenshot shows the command line output

Screenshot command line output

The following screenshot shows the html email

Screenshot html email

# Get disk information from computer MYSERVER
    
.\Get-Diskpace.ps1 -ComputerName MYSERVER


# Get disk information from computer MYSERVER in MB

.\Get-Diskpace.ps1 -ComputerName MYSERVER -Unit MB


# Get disk information from all Exchange servers and send html email

.\Get-Diskpace.ps1 -AllExchangeServer -SendMail -MailFrom postmaster@sedna-inc.com -MailTo exchangeadmin@sedna-inc.com -MailServer mail.sedna-inc.com

 

Links

Enjoy.

 


You need assistance with your Exchange Server setup? You have questions about your Exchange Server infrastructure and going hybrid? You are interested in what Exchange Server 2016 has to offer for your environment?

Contact me at thomas@mcsmemail.de
Follow at https://twitter.com/stensitzki

Read More »

Sometimes you need to know the version of the installed .NET Framework version quickly.

Simply use the following PowerShell one-liner:

(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' ).Release
DWORD Value Version
378389 .NET Framework 4.5
378675 .NET Framework 4.5.1 installed with Windows 8.1 or Windows Server 2012 R2
378758 .NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2
379893 .NET Framework 4.5.2
On Windows 10: 393295
All other OS: 393297
.NET Framework 4.6
On Windows 10 November Update: 394254
All other OS: 394271
.NET Framework 4.6.1
On Windows 10 Insider Build 14295: 394747
All other OS: 394748
.NET Framework 4.6.2 Preview

Enjoy!

Links

 

Read More »
Last updated: 2017-11-11

A new PowerShell script to export all mailbox folder permissions has been published to TechNet Gallery and GitHub.

This script exports all mailbox folder permissions for mailboxes of type "UserMailbox". The permissions are exported to a local CSV file.

CSV Eample

"Mailbox";"FolderName";"User";"AccessRights"
"Mustermann, Max (mmustermann)";"Tasks";"Doe, John";"Editor"
"Mustermann, Max (mmustermann)";"Calendar";"Doe, John";"Editor"
"Mustermann, Max (mmustermann)";"Inbox";"Doe, John";"Reviewer"
"Mustermann, Max (mmustermann)";"Custom Folder";"Doe, John";"Reviewer"

This script is based on Mr Tony Redmonds blog post http://thoughtsofanidlemind.com/2014/09/05/reporting-delegate-access-to-exchange-mailboxes/

Example

.\Get-MailboxPermissionsReport.ps1 -CsvFileName export.csv

Links

Enjoy.

Read More »
Last updated: 2019-06-14

 

Description

This script exports all mailbox folder permissions for mailboxes of the type UserMailbox. This is useful for documentation purposes prior to migration.

The permissions are exported to a local CSV file.

The script is intended to run from within an active Exchange Server 2013/2016/2019 Management Shell session.

Note

Gather mailbox folder permission data for a large number of mailboxes takes some time.

Example

# Export mailbox permissions to export.csv

.\Get-MailboxPermissionsReport-ps1 -CsvFileName export.csv

Version History

  • 1.0, Initial community release
  • 1.1, Minor PowerShell fixes
  • 1.2, Minor PowerShell fixes
  • 1.3, MailboxId parameter added
  • 1.4, Fix to ensure mailbox uniqueness using the alias property

Links

Additional Credits

The script is based on Mr. Tony Redmonds blog post http://thoughtsofanidlemind.com/2014/09/05/reporting-delegate-access-to-exchange-mailboxes/ 

Follow

Read More »