Matt Carey's Blog

Exchange 2010 transport log report using CSV

by on Feb.29, 2012, under Exchange 2010, Powershell

$date = Get-Date
$today = $date.ToShortDateString()
$lastweek = $date.AddDays(-7).ToShortDateString()
$result = Get-MessageTrackingLog -recipients <enter email address here> -start $lastweek -end $today | Select-Object Timestamp,Sender,MessageSubject
$csvresult = $result | Export-Csv c:\scripts\solution_center_emails.csv

# Configuration
$emailFrom = “<enter from address here>”
$emailTo = @(“address1@domain.com“,”address2@domain.com“)
$emailSubject = “<enter subject here>”
$emailBody = “See the attached file in CSV format for the calls from $lastweek to $today”
$emailAttachment = “c:\scripts\solution_center_emails.csv”
$smtpServer = “<enter SMTP server here>”

# Send E-Mail
Send-MailMessage -To $emailTo -From $emailFrom -Subject $emailSubject -Body $emailBody -Attachment $emailAttachment -SmtpServer $smtpServer

#Clean up / Remove File
if (Test-Path $emailAttachment) {Remove-Item $emailAttachment}

Leave a Comment more...

Exchange 2010 transport log report using HTML

by on Feb.29, 2012, under Exchange 2010, Powershell

$a = “<style>”
$a = $a + “BODY{background-color:white;}”
$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:white}”
$a = $a + “TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:white}”
$a = $a + “</style>”

$date = Get-Date
$today = $date.ToShortDateString()
$yesterday = $date.AddDays(-1).ToShortDateString()

$result = Get-MessageTrackingLog -recipients <enter email address here> -start $yesterday -end $today | Select-Object MessageSubject,Sender,Timestamp
$htmlresult = $result | ConvertTo-HTML -head $a -body “<H4>Emails addressesd to <enter email address here> from $yesterday to $today</H4>”

# Configuration
$emailFrom = “<enter from address here>”
$emailTo = “<enter to address here>”
$emailSubject = “<enter Subject here>”
$emailMessage = $htmlresult
$smtpServer = “<enter SMTP server here>”

# SMTP Object
$smtp = New-Object System.Net.Mail.SmtpClient($smtpServer)

# Send E-Mail
$msg = New-Object System.Net.Mail.MailMessage $emailFrom, $emailTo, $emailSubject, $emailMessage
$msg.isBodyhtml = $true
$smtp.send($msg)

Leave a Comment more...

Adding receive connector IP addresses using PowerShell

by on Feb.03, 2012, under Exchange 2010, Powershell

Be sure to modify your values for the connector name, and file path. This will append to the existing path, not over write it. It will throw an error and continue if a value already exists.

 

$rc = Get-ReceiveConnector -Identity “Anonymous SMTP Relay Connector”
Get-Content “c:\scripts\addrelayips.txt” | foreach {$rc.RemoteIPRanges += “$_”}
Set-ReceiveConnector “Anonymous SMTP Relay Connector” -RemoteIPRanges $rc.RemoteIPRanges

Leave a Comment more...

Delete files older than N days old

by on Jan.04, 2012, under Uncategorized

Simple forfiles command:

forfiles /P X:\ /D -3 /S /C “cmd /c del @path /Q”

Make sure X:\ is a valid path, or is mapped to your desired path before running this. This specific command will remove files older than 3 days old, and will do it recursively without prompting.

Leave a Comment more...

Exchange 2010 management console will not open

by on Dec.05, 2011, under Exchange 2010

Here is a fix to try, worked for me on one server.

C:\users\<specific user>\AppData\Roaming\Microsoft\MMC\Exchange Management Console\ there is a config file. Delete it

In the registry under HKCU\Software\Microsoft\Exchangeserver\v14\AdminTools\NodeStructureSettings delete the value NodeStructureSettings

Leave a Comment more...

“No description found” message when editing a maintenance plan in SQL 2005

by on Oct.25, 2011, under Microsoft SQL

Here is the fix:

Before you open the management studio, run this to re register the proper DLL’s.

Regsvr32 “C:\WINDOWS\system32\msxml6.dll”
Regsvr32 “C:\WINDOWS\system32\msxml3.dll”
Regsvr32 “C:\WINDOWS\system32\msxml.dll”
regsvr32.exe ole32.dll

Then open the management studio and you will be able to save the changes to your maintenance plan.

Leave a Comment more...

Finding an ESX hosts serial number from CLI

by on May.16, 2011, under VMWare

Login to the CLI using putty, su -, then run this

/usr/sbin/dmidecode |grep –A4 “System Information”

Gives you model number, machine type, and serial number.

Leave a Comment more...

How to enable (or disable) 8.3 short name support on Windows Server 2008

by on May.10, 2011, under Windows Server 2008

fsutil.exe behavior set disable8dot3 0

0 will ENABLE 8.3 file names, 1 will DISABLE it.

Leave a Comment more...

The name on the security certificate is invalid or does not match the name of the site

by on Apr.28, 2011, under Exchange 2007

When starting Outlook, I was getting a cert error that said this. What I did to fix it:

1. Removed all the certs that it would let me from the Exchange server. I had to leave the default there so that I did not break SMTP.

2. Created a new cert with the following in there for the SANs

externaldomain.com
mail.externaldomain.com
autodiscover
autodiscover.internaldomain.local
servername
servername.internaldomain.local
internaldomain.local

Don’t forget the last SAN of internaldomain.local alone.  Imported this certtificate, and enabled it for IIS and SMTP, replacing the old certificate. I then deleted the old one, and all was well again.

Leave a Comment more...

VMWare iSCSI connection notes

by on Apr.14, 2011, under VMWare

For setting up multi pathing on VMWare with iSCSI devices.

To find which vmhba corresponds to the vmnic:
esxcli swiscsi vmnic list -d vmhba##

To bind the iSCSI VMkernel port to the iSCSI adapter:
esxcli swiscsi nic add -n <vmk port name> -d <vmhba name>

To verify that the port was added to the iSCSI adapter:
esxcli swiscsi nic list -d vmhba##

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!