Script for getting the Downtime report of all databases in the server.

AhmedAliShaik used Ask the Experts™

We are calculating SLA based on the downtime of each storage group.

For example:

OUr server has 50 SG groups. If we are dismounting the DB for some maintainance or troubleshooting & mount it. The time will be considered as downtime.

I have a shell command which gives me the date & time of all the dismount and mount status of a server.

get-eventlog -LogName Application -Newest 20000 | Where-Object { $_.EventID -like "103" } | ft timewritten, eventid

get-eventlog -LogName Application -Newest 20000 | Where-Object { $_.EventID -like "102" } | ft timewritten, eventid,

event 103 lists all dismounted SG list and 102 list all mounted DB list with date & time.

My question is:

Can we consolidate all in a excel sheet and calculate the downtime by substracting the dismount time - mount time in a good format.

Plz give me ur ideas.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Topic Advisor
Most Valuable Expert 2016
Hi, I'm no powershell expert but I'd start by getting your output in .csv format so you can import easily into Excel, adding this to your get command would give you csv output:

| Export-Csv "Ouput.csv" -NoTypeInformation -Encoding ASCII -Delimiter ";"



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial