Thursday, January 17, 2019

Remote Mailboxes - Hybrid Config - Missing

The Remote Mailbox exists on the On Prem Exchange server and linked to the Office 365 mailbox. Without one of these for each Office 365 mailbox, you won't be able to configure Outlook to connect to the mailbox. The most common scenario that causes this issue is when you create a new user simply by creating the AD account, synchronizing it using DirSync/AADSync, and then licensing the user without creating a mailbox on prem and migrating it. This will give you a mailbox in Office 365, but does not create the remote mailbox on prem.

The correct way to provision new users in Office 365 is to create new Remote Mailboxes.

If a Remote Mailbox isn’t present or has been accidentally deleted, you can create one and link it up to the Office 365 mailbox.

We can resolve this manually by completing the following steps:

From the Exchange Management Powershell (On-Prem)
Enable-RemoteMailbox username –RemoteRoutingAddress alias@domain.mail.onmicrosoft.com

Get the Mailbox GUID of the Office 365 mailbox (O365 Powershell)
Get-Mailbox –Identity emailaddress | fl Identity,ExchangeGUID

Copy the Mailbox GUID and place this into Exchange Management Sell (On-Prem)
Set-RemoteMailbox username –ExchangeGUID "GUID Copied from Last Step"


After you have completed these steps you should force an AD synchronization from DirSync

Monday, September 22, 2014

Permanently removing Requests from SCSM 2012

There isn't a native way (that I could find) to remove Request from System Center Service Manager. Of course, I found a way to do it through the-all-mighty Powershell.
I know... ITIL/Compliance/ITSM you shouldn't ever delete any records but I'm in the middle of building out a new deployment of SCSM 2012 and I've entered a TON of test requests and it was "suggested" that I remove them prior to going live.

So yeah, I removed them - even though only Analyst could see them and they would soon fade out of sight as legit tickets begin to stream into the new system.

get-scsmclassinstance -class (get-scsmclass -name system.workitem.incident) | where-object {$_.id -eq "IR12345"} | Remove-scsmclassinstance

Thursday, August 28, 2014

Exchange 2010 - Creating a Dynamic Distribution List from an AD Security Group

As part of SCSM group notifications I wanted a way to provide security; separate the analysts into groups; be able to provide email addresses for each of the groups; and not have to manage the groups myself.

Enter - Dynamic Distribution Groups

I opened the Exchange Administration Console and started creating a new Dynamic Distribution Group (DDG). I quickly realized that I am unable to filter the DDG based on an Active Directory Security Group (ADSG) like I thought I could.

Quick google search later and I found this technet article

Here is what I came up with Open the Exchange Shell and enter the following commands:

New-DynamicDistributionGroup -Name "NAME_OF_DDG_TO_CREATE" -RecipientFilter {(RecipientTypeDetails -eq 'UserMailbox') -and (MemberOfGroup -eq 'CN=ADSEC_GROUP,OU=GROUPS,DC=SOMEWHERE,DC=COM')

Then I was able to find my DDG in the Exchange Administration Console and set other options like:

  • "Managed By"
  • "Select the recipient container where you want to apply this filter" (by default this points to domain/Users and we have moved all users into a different container for organization)
  • "Hide group from Exchange address lists" (I don't want people to be able to email these groups directly
  • "Do not send delivery reports" (No need since all of these emails are coming from Orchestration Runbooks as the SCSM notifications)

Monday, August 11, 2014

Check for Running Task & Start

We have an open source Application call iSpy Connect that monitors all of the IP cameras in the building. This software (because we aren't paying for the licensed version) runs as a standard application and not as a service. This causes issues when someone logs into the server to check a recording and closes the Application or logs out. Now the software isn't running which means it isn't recording camera activity. I wrote this powershell script to check to see if the service was running. If it's running it just closes... if it's not running it will start the application. It looks like this -
#Process Name
$procToCheck = "iSpy"

#Process exe location
$procFileExe = "C:\Program Files\iSpy\iSpy (64 bit)\ispy.exe"

#Checks for running process and starts if needed 
$process = Get-process $procToCheck
if (!($process)) {
 start-process $procFileExe
}
And added a 15 minute task in Task Scheduler following these steps: Create Basic Task Name Task and Description Schedule it Daily Run it Every Day Start a Program Program/Script: powershell.exe Add arguments (optional): -file "c:\scripts\ispy_Running.ps1" Check the box to open the Properties dialog for this task when clicking Finish Double click the trigger created to edit the trigger Check the box to Repeat the task every: - And set it to 15 minutes or whatever is appropriate Change the duration to Indefinite Save your changes and that should create a task that will monitor for your program running and start it should it close (or be closed)

Wednesday, April 30, 2014

Excel - Format Data Cell for kb/mb/gb

Have you ever exported a powershell script only to see values like 876755433?

Have you ever wanted an easy way to format that number auto-magically into a kb's mb's or gb's?

Use the following process:

In Excel
Select the column needed to format
Right click column header
Choose "Format Cells"
Choose the "Custom" option under the "Number" tab
Paste this value - [<1000]#,##0.00" KB ";[<1000000]#,##0.00," MB";#,##0.00,," GB"
And click OK


MAGIC!

Monday, April 21, 2014

Remote DNS Check

In moving our data center the request was made to identify all servers with static IP's that had DNS entries of servers that we were being decommissioned.
This is what I used -
param( 
  [parameter(ValueFromPipeline=$TRUE)] 
    [String[]] $ComputerName=$Env:COMPUTERNAME, 
    [System.Management.Automation.PSCredential] $Credential 
) 
 
begin { 
  $PipelineInput = (-not $PSBOUNDPARAMETERS.ContainsKey("ComputerName")) -and (-not $ComputerName) 
 
  # Outputs the computer name, IP address, and DNS and WINS settings for 
  # every IP-enabled adapter on the specified computer that's configured with 
  # an IPv4 address. 
  function Get-IPInfo($computerName) { 
    $params = @{ 
      "Class" = "Win32_NetworkAdapterConfiguration" 
      "ComputerName" = $computerName 
      "Filter" = "IPEnabled=True" 
    } 
    if ( $Credential ) { $params.Add("Credential", $Credential) } 
    get-wmiobject @params | foreach-object { 
      foreach ( $adapterAddress in $_.IPAddress ) { 
        if ( $adapterAddress -match '(\d{1,3}\.){3}\d{1,3}' ) { 
          foreach ( $dnsServerAddress in $_.DNSServerSearchOrder ) { 
            new-object PSObject -property @{ 
              "ComputerName" = $_.__SERVER 
              "IPAddress" = $adapterAddress 
              "DNSServer" = $dnsServerAddress 
            } | select-object ComputerName,IPAddress,DNSServer 
          } 
        } 
      } 
    } 
  } 
} 
 
process { 
  if ( $PipelineInput ) { 
    Get-IPInfo $_ 
  } 
  else { 
    $ComputerName | foreach-object { 
      Get-IPInfo $_ 
    } 
  } 
}

Gather all 5 FSMO Roles with Powershell

<#
This simple script will pole your domain for the 5 FSMO roles
#>
import-module activedirectory
$fqdn = Read-Host 'Domain Name'
$forest = get-adforest $fqdn | Format-Table SchemaMaster,DomainNamingMaster
$domain = get-addomain $fqdn | Format-Table PDCEmulator,RIDMaster,InfrastructureMaster
$info = $forest,$domain
$info

Remote Mailboxes - Hybrid Config - Missing

The Remote Mailbox exists on the On Prem Exchange server and linked to the Office 365 mailbox. Without one of these for each Office 365 mail...