+
  
SERVICES
  
PRODUCTS
  
CONTACT US

DataCommand Pty Ltd is now an ICN Gateway Premium Member. You can view our ICN Member Profile by clicking here.

View profile on ICN Gateway

Even the best most well maintained Exchange Database can have issues from time. Best practices such as ensuring adequate disk space, online archives, quota and above all importance – backups as absolutely necessary. The best way to prevent database issues is to backup and attempt to steer away from any possible problems.

If you ever do get database issues, follow the below route to restore. This is what we’ve found as the best/fastest route. Note that it is intended to restore the Database with no data loss but also steps you through the worst case scenario of doing a full repair.

1. The first step with a corrupt Mailbox Database is to make a copy of your Database log files. These are all files (except your EDB database file) in the database directory. The reason for the copy is that this is a last resort (shown in step 5 below) in order to restore your database and replay unaltered log files so no data is lost.

2. Check your Exchange database health state by using the below command. Note that Exchange 2013/2016 can report a database is mounted in ECP even if that isn’t the case.
Note: You should replace the text in quotations with your own path to the EDB database file. Typically this will be C:\Program Files\Microsoft\Exchange\V15\Mailbox\ with a version number matching your server.

eseutil /mh “C:\path\database.edb”

This will output some text on screen. You should look for the ‘state’ line that states either ‘Clean Shutdown’ or ‘Dirty Shutdown’.

3. To remove a dirty shutdown state, try running the below command:

eseutil /r E00 /l “C:\path” /s “C:\path” /d “C:\path”

Notes:

  • /r sets eseutil to Recovery Mode. This also requires the Database log format, typically E00 for the first database followed by E01. You can check this by navigating in to your Log file directory and listing the files. They will start with the digit E00 or E01, etc.
  • /l is the path to your log files. By default this is that same location your EDB file is stored.
  • /s is the path to your checkpoint file, such as E00.chk. This is also normally the same path as your EDB file.
  • /d is the path to your EDB file.

4. If this works it should return your Database to a ‘Clean Shutdown’ state. Run the command shown in step 2 to check this.

5. If this doesn’t work, the next best step is restore from backup.

  • Firstly, make a sideways copy of your EDB file. This is required if the soft repair /r doesn’t work.
  • Now restore your last successful backup of the EDB file to its correct path.

6. To replay log files correctly, navigate to your log files directory and move the E00.chk file to another folder. The checkpoint file will point to specific location in the logs to restore from. Deleting the file should start the replay process as log 1 and continue until complete.

7. Now run the below command to replay the log files. The log files should be your original copy of the log files copied back to their usual location.

eseutil /r E00 /l “C:\path” /s “C:\path” /d “C:\path”

8. Once complete run the command listed in step 2 of this process to check the State is now ‘Clean Shutdown’. If so mount the database and do some tests, everything should be ok.

9. If you get ‘Dirty Shutdown’ still the last option is running a full EDB repair. Note that doing this will not replay logs files so anything not already in the database will be lost. This is by far a last resort process. In some cases data loss may be minimal and staff using Outlook with Cached Mode enabled may not even notice. Staff without Outlook/Cached mode could loose bulk amounts of emails.

Run the below command to do a full repair. Note that the repair process could take anywhere from 15 minutes to multiple days depending on the size of the database.

eseutil /p “C:\path\database.edb”

10. Once complete, run the command in step 2 once more and check for “Clean Shutdown” in the status. If so mount the database and do some tests.
After this you should have a working Exchange Database once more.

11. Do a full system backup of your Exchange server and Databases immediately after this process.

Note: If you performed a full repair (/p) Microsoft strongly recommend creating a new blank Exchange database and moving all mailboxes in the repaired EDB to the new database. This avoids possible further corruptions and potential downtime/loss of data.


Note: Before following the below procedure, if you are running Windows Server 2008/2012 please be sure to install the ‘Desktop Experience’ feature from Server Manager.

1. Run the below from a command prompt or run dialog window. The /sageset command allows you to record required settings for the Disk Cleanup tool to run silently.

%windir%\system32\cleanmgr.exe /sageset:1

Note: The /sageset:1 can actually be any number up to 65535. This is done so you can have multiple saved settings.

2. Once run, the Disk Cleanup tool will show. Tick your required files to be cleaned (or all) and click OK to save.

3. Create a scheduled task in Windows running the below command. This will repeat as scheduled cleaning the same selected files each time it is run. You can create multiple schedules for each setting you have saved by typing the required saved numbers in the /sagerun option (those you have set in step 1).

%windir%\system32\cleanmgr.exe /sagerun:1

@echo off

rem REPLACE PC NAME/IP ADDRESS BELOW WITH REQUIRED.
set pc_name=192.168.1.1

:start
echo Please wait, testing if PC is online.
cls
ping -n 1 %pc_name% > nul
if %errorlevel% == 0 goto run_command
echo.
echo PC is currently offline.
echo.
echo Waiting 120 seconds…
ping -n 120 127.0.0.1 > nul
goto start

:run_command
cls
echo PC is online. Waiting 60 seconds for services to start.
echo.
ping -n 60 127.0.0.1 > nul
echo.
echo Running command…
echo.

REM COMMAND TO RUN GOES HERE.

goto END

:END
pause

In the past we’ve had to delete some network printers drivers on couple of Windows 7 machines.
As usual went to Print Server > [computer] > Drivers > [driver] > Remove Driver Package
After confirming removal by clicking Delete was presented with an error message:
Failed to remove driver [driver name]. The specified printer driver is currently in use.

Windows XP these kind of issues would be normally resolved by deleting printer and restarting Print Spooler service. Unfortunately in this case it didn’t work.

A quick search online revealed that often recommended solution is to delete printer from every single user profile who was ever logged on this machine. We had over 10 user profiles on this machine so we weren’t very keen to try it.

After some searching we found another, quicker way to achieve the same result. The trick is to delete the driver during the start of the print spooler service.

– Open Devices and Printers and remove device(s) which is using drivers in question.

– Open Print Management and Services management consoles side by side.

– In Print Management right click on the driver you want to remove and click Remove Driver Package

– A confirmation dialog will pop up with a Delete button shown, leave this screen open and do not click Delete at this time.

– Open the Services Dialog.

– In Services right click on Print Spooler and click Stop

– In Services right click on Print Spooler and click Start

– As soon as the print spooler is starting, click the Delete button from the Delete Printer Dialog screen.

– If you selected multiple drivers to delete, you may have to repeat this process until all printer drivers are gone.

If you’re having issues with your internet connection and finding your Router is dropping Internet at random times, the below windows batch may help alleviate the issue as a temporary measure.

To run this, download a copy of plink.exe from the putty download page and save it to a server running onsite (as an example to C:\admin\plink.exe). Copy the below into a batch file in the same directory and save the file. You can then use Task Scheduler to run the task automatically during the day.

The script pings www.google.com and is the ping fails triggers a reboot on the router.

If needed you could setup this to email using VBS and/or log the reboots in a file by pipping the information out (you can do this by typing “ >> C:\admin\plink_log.txt” without the quotes at the end of the reboot command).

@echo off
ping -n 1 www.google.com
IF ERRORLEVEL 0 GOTO END
echo reboot|”C:\admin\plink.exe” -ssh -pw ******** admin@192.168.1.1 reboot
:END

In most cases, we’ve found Exchange Management Console (EMC) and/or Exchange Management Shell (EMS) by default to load very slowly on PCs. To correct this you can follow the steps below.
Note: The default security options changed in the below are recommended by Microsoft and this can present a risk unless the machine is in a secure environment.

Turn off (Uncheck) “Check for publisher’s certificate revocation” & “Check for server certificate revocation” options on the server/workstations you are starting the EMC on

· In Windows Internet Explorer –> Tools –> Internet Options –> Advanced tab

· In the Security section, uncheck the below two options “Check for publisher’s certificate revocation” & “Check for server certificate revocation”

Based on the default settings in Internet Explorer, the EMC will always try to connect to the Certificate Revocation List (CRL) web site. Exchange examines the CRL list to verify the code signing certificate. This process in most cases take a long time, therefore the delay.

The below is a script written to output all Distribution Lists (DL) and DL Members to a CSV File.

Note that the variable set in the first line of the script is the CSV Output Location and you should change the line with ‘RemoteExchange.ps1’ to the location of your Exchange directory.

set-variable -name exportCSVFileLocation -value “C:\temp\Export.csv”
Remove-Item “$exportCSVFileLocation”
Cls
echo “”
echo “**********************************************”
echo “Export All Distribution Lists and Users to CSV”
echo “**********************************************”
echo “”
echo “CSV File Output Location: $exportCSVFileLocation”
echo “”
echo “Exporting, Please wait…”
echo “”
. ‘C:\Program Files\Exchange Server\V15\bin\RemoteExchange.ps1’
Connect-ExchangeServer -auto | out-null
foreach ($group in Get-DistributionGroup) { get-distributiongroupmember $group | sort displayname | select-object displayname,recipientType,@{Label=”Group Name”;Expression={“$group”}} | export-csv -append “$exportCSVFileLocation”}
echo “”
echo “Export Complete”
echo “”
pause

If changes need to be made on permissions to be able to book a meeting room, the best way you can affect any changes is through the Exchange Management Shell (EMS).

There are two settings “bookinpolicy” and “requestinpolicy” that need to be updated. The commands need to be run one after another.

Firstly, you need to get the existing settings:
get-mailboxcalendarsettings ExecOfficeMeetingRm | fl name, requestinpolicy
get-mailboxcalendarsettings ExecOfficeMeetingRm | fl name, bookinpolicy

Each time you change the setting, it is an “overwrite” process, so you cannot simply add or remove a single name.

The Following is an example from within EMS using the set-mailboxcalendarsettings cmdlet.

set-mailboxcalendarsettings “Meeting Room Name” -AutomateProcessing AutoAccept -RequestInPolicy “user1”, “user2”, “user3”, “user4”, “user5”, “user6”, “user7”
set-mailboxcalendarsettings “Meeting Room Name” -AutomateProcessing AutoAccept -BookInPolicy “user1”, “user2”, “user3”, “user4”, “user5”, “user6”, “user7”

In the above two commands, simply replace the “Meeting Room Name” with your meeting rooms name and replace the userX sections with you username for as many users as required.

To validate the system changes have been made, run the below command:
get-mailboxcalendarsettings “Meeting Room Name” | fl name, bookinpolicy, requestinpolicy

To correctly destroy a session in PHP, use the below code. It will destroy all variables, cookies and the session itself.

<?php
// Initialize the session.
// If you are using session_name(“something”), don’t forget it now!
session_start();

// Unset all of the session variables.
$_SESSION = array();

// If it’s desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get(“session.use_cookies”)) {
$params = session_get_cookie_params();
setcookie(session_name(), ”, time() – 42000,
$params[“path”], $params[“domain”],
$params[“secure”], $params[“httponly”]
);
}

// Finally, destroy the session.
session_destroy();
?>


Want to say hey or find out more?


If you're part of a small/medium or enterprise level we
can help address your IT Management needs.

Get in touch
    
View our Services
                
Make your data
work for you.
Contact Us

+61 438 661 875
inquiries@datacommand.com.au

     

Copyright © DataCommand Pty Ltd / Privacy Policy
ABN 98 205 256 068 / ACN 131 977 323