Exchange Online Mailbox Types

That is interesting.  Been playing with Exchange Online Mailbox types.

With the -Type parameter specifies the mailbox type for the mailbox. Valid values are:

  • Regular
  • Room
  • Equipment
  • Shared

Now I had never noticed this before, but when you switch a mailbox to anything other than Regular, the UserAccountControl changes to AccountDisabled.

That would explain why authenticated SMTP relay to smtp.office365.com would stop working :-o

 

Office 365 SMTP Relay Using Windows PowerShell

We are looking to the future, and getting ready to remove OnPrem Exchange.  To do this we need to deal with SMTP Relay.

Microsoft have this doc to help: https://support.office.com/en-gb/article/How-to-set-up-a-multifunction-device-or-application-to-send-email-using-Office-365-69f58e99-c550-4274-ad18-c805d654b4c4

But I wanted to code it ;-)

Quite simple, you need to use an Exchange Online Account:
$Password = "#mailbox password"
$emailFrom = "#mailbox"
$SMTPServer = "smtp.office365.com"
$SMTPPort = 587
$emailTo = "#recipient"
$msgsubject = "testing testing 1-2-3"
$msgBody = "hello world"
$message = New-Object Net.Mail.MailMessage($emailFrom, $emailTo, $msgsubject, $msgBody)
$message.IsBodyHTML = $True

$smtp = New-Object Net.Mail.SmtpClient($SMTPServer,$SMTPPort)
$smtp.EnableSSL = $true
$smtp.Credentials = New-Object System.Net.NetworkCredential($emailFrom, $Password);
$smtp.Send($message)

enjoy

Using Windows PowerShell to Find an AD User across multiple domains

So, I have a single forest with multiple domains.  I wanted to use the native ActiveDirectory module for find a SamAccountName.

I came up with this:

$sam = "mysam"
$domains = (Get-ADForest).domains
ForEach($domain in $domains){
  Write-Host $domain
  Get-ADUser -Filter 'SamAccountName -eq $sam ' -Server $domain -Properties *| select DistinguishedName
}

Then I had a brain fart!  Why not use a GC?  Its quicker ;-)

$sam = "mysam"
$forest = (Get-ADForest).Name + ":3268"
Get-ADUser -Filter 'SamAccountName -eq $sam' -Server $forest -Properties * | select DistinguishedName

enjoy!

Quest Support Product Release Notification – Enterprise Reporter 3.0

From Quest

“We are excited to announce a new version of Enterprise Reporter 3.0 is now available for download.
Look what’s new:

  • Check out the “What’s New with Enterprise Reporter 3.0” video
    • Support for Office 365 – Azure AD, Exchange Online, and OneDrive for Business
      • Including Azure Tenant, Subscription and Licensing information
    • Take action with Security Explorer Remediation Reports
    • Performance Enhancements with NTFS Collector
    • Enhanced Data Collections with new attributes
    • Configuration options to integrate with IT Security Search “

Using Windows PowerShell to “normalise” a text string

Long story, but I  needed a way to normalise a text string.  Say this:

$txt = "Correo electrónico del usuario"

and I found this:

[Text.Encoding]::ASCII.GetString([Text.Encoding]::GetEncoding(1251).GetBytes($txt))

and the result is:

Correo electronico del usuario

Awesome, job done!