Archive for May, 2016

Usually you would like to know last time a database was restored. This is very handy script to show you the details.

WITH LastRestores AS
DatabaseName = [d].[name] ,
[d].[create_date] ,
[d].[compatibility_level] ,
[d].[collation_name] ,
RowNum = ROW_NUMBER() OVER (PARTITION BY d.Name ORDER BY r.[restore_date] DESC)
FROM master.sys.databases d
LEFT OUTER JOIN msdb.dbo.[restorehistory] r ON r.[destination_database_name] = d.Name
FROM [LastRestores]
WHERE [RowNum] = 1

You can simply get the details from dbo.restorehistory from MSDB databases. However, the above script will provide more details.

To setup the MFA for the first time follow the steps below.

Your company should provide you with a login details to Office 365. The access is usually through the Office 365 portal or SharePoint Online. Once you have the link and credentials follow the steps below:

1.Go to the provided URL ( or

2. Type in Work username and password then click “Sign in”









3. You will get the below message to setup MFA click on “Set it up now”











4. Another window opens that asks you – How should we contact you? Fill the details and click “Contact me”.










There are different options here. I have chosen to send me a text message.

5. You will receive a text message with a verification number. Enter the number on the new window and click “Verify











6. Once the verification is completed you will see the Additional security verification. You should copy the password somewhere safe you will use this password to login to Skype for Business and other apps. Once completed click “Done”











7. You will be logged into the Office 365 portal or SharePoint site depending on what link you have used.

Any subsequent logins will require you to use a verification code which will be sent to the phone you have selected initially or choose a different verification method.