Remove a users photo in Exchange

Scenario:  You need to remove a user’s photo in Exchange. You have verified that the thumbprintphoto attribute is <not set> in Active Directory, but the photo is still showing in Exchange.

Cause:  The mailbox stores a high-resolution photo in the mailbox in additional to the photo that is stored in AD.  You will need to remove it from the mailbox.

Solution:  Run the following PowerShell command to remove the photo for testuserA.

Remove-UserPhoto testuserA

 

Event ID 7000: The Cluster Virtual Miniport Driver service failed to start

Scenario:  When troubleshooting cluster related issues,  we found we could not start the cluster service. When we tried to start the service, we found the following entry in the System log:

Event ID: 7000 –  Source:  Service Control Manager

The Cluster Virtual Miniport Driver service failed to start due to the following error: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

Solution:  In our case, the Microsoft Failover Cluster Virtual Adapter was no longer present under Network Adapters (View –> Show Hidden Devices) in the Device Manager.  To reinstall it, perform the following:

  • Click on the server at the top of the device manager
  • Add legacy hardware
  • Install Hardware Manually
  • Select Network Adapters
  • Select Microsoft
  • Select Microsoft failover cluster virtual adapter

Queue Buildups, Event IDs16025 and 205, and “You do not have permission to perform this action” when sending a message

Scenario:  You are troubleshooting an issue where you have the following symptoms:

  • When sending a message via any client the message is getting stuck in the Outbox/Drafts.
  • In Outlook Web it states “You do not have permission to perform this action” when attempting to send a message.
  • The Queues are backed up and not draining
  • Event IDs 16025 and 205 are in the event log for MSExchange Common and MSExchange Transport

Solution:  Make sure the ‘Register this connection’s addresses in DNS checkbox is checked.  This is required in order for Exchange Transport to operate correctly.  Once this was set, all was well.

Powershell: You want to determine which Exchange admin ran a PowerShell command edited a specific mailbox

Scenario: You want to determine which Exchange admin edited/altered the mailbox of a specific user HarryJ.  HarryJ could no longer access OWA as someone disabled it.  Now to determine  the admin that made the change.

Solution: Run the following:

Search-AdminAuditLog -cmdlets Set-CasMailbox -startdate “2/28/201 7:00PM” -enddate “3/1/2017  9:00AM” | Where ObjectModified -like *HarryJ* | Out-gridview

Install Windows Updates and Hotfixes from Command Line

Scenario:  You have a lot of Windows Updates and Hotfixes that you need to install manually.  You want to do the following:

  1. Script the install
  2. Do not restart the server after the update is installed — (so you can manually restart it when you are ready)

Scriptlets:

Download the updates to a folder and copy that folder to the servers requiring the update.

#Collect your Servers into a variable
$Servers = Get-exchangeserver ex*

#Create an folder to copy your updates to
$Servers.name | %{ MD \$_c$updatesCluster_Updates }

#Copy your updates to that new folder
$servers.name | %{ Copy-item "C:Cluster_updates*.msu" "\$_c$updatesCluster_updates"

Install the updates on each server by running the following command from an elevated command prompt:

FOR %h IN (*.msu) DO START /WAIT WUSA %h /QUIET /NORESTART

To verify the updates are installed on each one of your servers, run the following PowerShell commandlet:

$servers.name | %{ get-hotfix -computername $_ | Where InstalledOn -gt 2/5/2017}

 

 

 

Powershell: Run a Scheduled Task Remotely

Scenario:  You want to run a Scheduled Task remotely without needing to remote into the server, open task scheduler, and execute the task.

Solution:  Run the following in Powershell with appropriate permissions:

schtasks /run /s exchsvr1 /tn "exchange monitor"

If you want to loop it so it runs manually every 30 minutes, run the following:

#When the counter reaches 30, that’s 15 hours

$counter  = 0

Do{
schtasks /run /s exchsvr1 /tn "exchange monitor"
sleep 1800
$counter++
“$counter – Running script”
} While ($counter –lt 30)

 

Remove an Exchange Server from Autodiscover lookups

Scenario:  You have a server where you need to change the namespaceconfiguration settings of your client access virtual directories and you do not wish for this server to hand these server settings out with autodiscover.

Solution:  Run the following Powershell so it will not participate in the SCP lookup:

Set-ClientAccessServer  2016ExSrv1 -autodiscoverserviceinternaluri $null

Use MFCMapi to locate the Categories used in your mailbox

Scenario:  After mailbox categories have mysteriously disappeared, you want to verify that the categories are not hanging around in the backend of your mailbox.  The concern is that you re-add the categories and if they mysteriously show up, it would create a headache to clean it up.

Solution: The categories that is used throughout the mailbox is located in a hidden area in the calendar. Using MFCMapi, navigate to the PR_ROAMING_XMLSTREAM by following:

  1. Session –>Logon
  2. Select the mailbox profile for the user affected.
  3. Expand Top of Information Store
  4. Right click on Calendar and select ‘Open Associated Contents Table’
  5. Select the entry with Subject  “IPM.Configuration.CategoryList”
  6. Locate and open the property “PR_ROAMING_XMLSTREAM”
  7. Copy the contents of the Text value into notepad and parse everything that starts with <category name =”…”
  8. Now you can see a list of every category that is associated with the mailbox.

 

PowerShell: Copy and rename file for to keep as a backup

Scenario:  You want to use PowerShell to make a backup of a specific file across many servers and store it locally.  We will perform this on a Web.Config file for IIS. The file once copied will be stored as C:SharebkupWebsvr1-wwwroot_web.config.

 

Script:

#Collect your Servers into a variable
$servers = "WebSvr1","WebSvr2","WebSvr3"

#Copy the file from the remote server to a local share

$Servers | %{
Copy-Item -Path "\$_c$inetpubwwwrootweb.config" -Destination "C:Sharebkup$_-wwwroot_web.config" 
}