Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Friday Fun: Thank God It’s a PowerShell Friday

Posted on December 27, 2019December 27, 2019

Well here we are at the last Friday of the year. In fact , the last Friday of the decade! On this auspicious occasion, let's have some PowerShell fun and celebrate Friday. No matter what you call it, I'm assuming Friday is your last typical workday and something we look forward to. However, the name Friday is obviously not universal. But PowerShell makes it easy to discover what to call it depending on where we are. In Windows, this is our culture.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

Get-Culture with PowerShell

This is a .NET object that has some interesting properties.

DateTime formats

As you can see it is pretty easy to find out what "Friday" is called.

Get day names with PowerShell

In Windows PowerShell, to check another culture you have to resort to using the .NET Framework.

Finnish day names

I'm not even going to try and pronounce this but this is "Friday" in Finland. What about the rest of the world?

First, let's get all available cultures.

$all = [System.Globalization.CultureInfo]::GetCultures("allCultures")

Next, let's see what "Friday" is around the world.

$all | Select-object -property Name,DisplayName,@{Name="Friday";Expression = {$_.Datetimeformat.daynames[-2]}}

Friday around the world

Or here's a random sample.

A collectiion of Fridays

By the way, if you were curious about the rest of the week you could use code like this:

[System.Globalization.CultureInfo]::GetCultures("allCultures") | 
Format-Table -group DisplayName -Property Name,
@{Name="Day1";Expression = {$_.Datetimeformat.daynames[0]}},
@{Name="Day2";Expression = {$_.Datetimeformat.daynames[1]}},
@{Name="Day3";Expression = {$_.Datetimeformat.daynames[2]}},
@{Name="Day4";Expression = {$_.Datetimeformat.daynames[3]}},
@{Name="Day5";Expression = {$_.Datetimeformat.daynames[4]}},
@{Name="Day6";Expression = {$_.Datetimeformat.daynames[5]}},
@{Name="Day7";Expression = {$_.Datetimeformat.daynames[6]}} -AutoSize

I 'll let you try it for yourself.

If you are running PowerShell 7, this is even easier as the Get-Culture cmdlet has been updated.

Getting day names with Get-Culture and PowerShell 7

Not only can we now specify a culture, we can easily list all of them.

#requires -version 7.0
Get-Culture -ListAvailable | Select-Object Name,Displayname,
@{Name="Friday";Expression = {$_.Datetimeformat.daynames[-2]}}

Fridays around the world via PowerShell 7

No matter what day it is I hope you enjoy it. And for some of you, "Friday" has already come and gone. Hope it was a good one.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

1 thought on “Friday Fun: Thank God It’s a PowerShell Friday”

  1. Richard Oswald says:
    December 31, 2019 at 12:59 am

    It’s hard to believe that it’s been a decade since Ed Wilson switched from vbscript to PowerShell and James Brundage introduced WPK as a kit to build your own tools. This certainly was a decade of PowerShell enjoyable scripting, so Cheers to all those that brought PS to the public!

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d