Where are the scripts in Exchange 2016?

Where are the scripts in Exchange 2016?
   Exchange has a folder with a complete suite of scripts that we use in the day-to-day managing activities or sometimes we are going to use only once, for example in a migration process if we need to migrate public folders to Exchange 2016 we need to use some scripts from this suite.

   In addition, there are scripts to put in maintenance mode the server in case that we need to stop the DAG due to reboot the server in order to complete a patching process or shutdown the server for another different reason.

   As well as exist the script to stop the DAG, as well exists the script to stop the maintenance mode or resume the mailbox databases copies.

   Other scripts are used to security and hygiene activities for example enable or disable antimalware, install or uninstall antispam agents.

   In the same suite we can find scripts to get metrics about the exchange organization, they have the capability to read information from the event logs of the servers in a DAG to gather information on databases mount, moves and failover over some range of time.

   In some cases, the script has a xml file with the same name with help information, this file is very helpful because you can see all the details related to the script execution, for example what king of parameters you need to include in the script execution; also,  what kind of information you need as output (data in the console, html or csv file, etc).

  The path of the scripts in Exchange 2016 is C:\Program Files\Microsoft\Exchange Server\V15\Scripts (in case you have installed Exchange in the C: drive) or you can use the exchange variable $exinstall who will send you to this directory:

   As well you can use the exchange variable $exscripts to go directly to the scripts folder in Exchange 2016
This is the directory where you can see all scripts into the server

Remember always test the scripts in another environment different to production.

Regards – Cheers – phir melenge – Hasta luego


How to search notes deleted in Exchange 2016


If the notes disappear from your outlook and you can’t find them, execute the follow command in Exchange Power Shell:
PS C:\> Search-Mailbox agonzalez -SearchQuery kind:Notes -TargetMailbox “Support” -TargetFolder “Recover” -LogLevel full -LogOnly
The switch –logonly means you are not going to copy the information, only you want to know if the notes are in the mailbox. You will have a result something like this:
ResultItemsCount : 134
Then you can remove the –logonly switch and copy the information to the target folder:
PS C:\> Search-Mailbox agonzalez -SearchQuery kind:Notes -TargetMailbox “Support” -TargetFolder “Recover” -LogLevel full 
In this case I used the support mailbox creating a new folder called Recover where I will copy the information from agonzalez.


How to view members of a Dynamic group or distribution list

Apply for exchange 2016

   We create a dynamic group to get the current users in a specific OU, region, office, department or any other filter, is helpful because you always have active users, which means that all disable users are not part of this group (or distribution list). but sometimes you need to be sure if a user belongs to this group, and therefore you need to execute the follow lines in Exchange PowerShell:

first, to retrieve all members of the dynamic group:

once you have all the information in the $Dyn variable, the next step is filter the information:

and you can see the information in PowerShell, but if you have a huge amount of users there, then you can export the information to a csv file:

And then use excel to search, filter or just store the file as record.

I hope this can be useful for you.


-Tony Gonzalez

problems with VSS WRITERS for backups

Sometimes you are not able to backup the exchange databases because you get an error regarding to the writter, here you have the information how to fix it.

Open a command prompt as an admin

To see what writer is failing please type:
vssadmin list writers

Open a command prompt as an admin and write the follow line:
 NET STOP MSExchangeRepl

Once the service is stopped:
NET Start MSExchangeRepl

if its  Microsoft Exchange Writer:
net stop MSExchangeIS
net stop VSS
net stop MSExchangeRepl
net start MSExchangeIS
net start VSS
net start MSExchangeRepl

And voila, tray again with your backup script and should work.