It is that time of year again. But instead of being freaked out by Friday the 13th, let's have a little fun. Here is a collection of PowerShell one-liners, all celebrating 13. And maybe you'll even pick up something new about PowerShell.
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!
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
#13^13
[math]::Pow(13,13)
#get the 13 letter from [CHAR] equivalent
#arrays start counting at 0
(65..90).foreach({$_ -as [char]})[12]
#pad Friday to 13 spaces
"Friday".padleft(13,"!")
#get the 13th process
(get-process)[12]
#13!
(1..13 | measure -sum).sum
#get 13 random numbers between 13 and 1313
1..13 | foreach {Get-Random -min 13 -max 1313}
#create a 13 character random password
-join ((33..126).foreach({$_ -as [char]}) | get-random -Count 13)
#get date and time 13 days, 13 hours, 13 minutes and 13 seconds from now
(Get-Date).AddDays(13).AddHours(13).AddMinutes(13).AddSeconds(13)
#Adding it all up
13+13KB+13MB+13GB+13TB+13PB
#13 Fridays in a row
"Friday"*13
#13 Fridays in a column (array)
1..13 | foreach { "Friday" }
#Get the 13 most recent events in the System eventlog
get-eventlog system -Newest 13
# A PS7 version
get-winevent -logname system -MaxEvents 13
#don't go in the lake
start http://www.imdb.com/title/tt0080761/