get-date

PowerShell Tip of the Week: Get name of a month and number of days

Recently I was working on a new report for entire environment. I had to calculate servers total uptime and downtime in previous month. I prepared script for that and one of the tasks was to check what was previous month name and number of days. Name of a month Concept of uptime report was that script will gather start/stop/crash information from eventlog and calculate time between of those events. It …

events

Extract dates from string and convert it to UTC

Today I want to show you how to extract dates from string. Recently I posted article about getting IP address from log file. This time its a little bit more compliacted as date format in string is invalid. Extract date from string Extracting dates from string is pretty simple if you know the regex pattern. In my case I had to get all dates from string and use it as …

Get date remotely and convert it to different time zone

Today I thought I would share a one of my PowerShell function that I wrote for converting time zones from remote servers. If you have large scale environment you are probably dealing with several different time zones on your machines. To get date in different zone you can use below function. Usage: Output: In this function I’ve just added most common time zones: UTC – Coordinated Universal Time IST – …