Powershell – Timespan countdown before

A Powershell script for an easy countdown before, here.. countdown before Christmas 🙂

A simply code using New-TimeSpan

$end_date = (Get-Date -Day 25 -Month 12 -Year 2018 -Hour 0 -Minute 0)
$Timespan = New-TimeSpan -Start (get-date) -End $end_date
$MsgBox = New-Object -ComObject wscript.shell
do {
Write-Output « $Timespan.Minutes »
$Timespan = New-TimeSpan -Start (get-date) -End $end_date
sleep 1
} until ($Timespan.Minutes -eq 0)
$MsgBox.Popup(« CHRISTMAS »)

 

enjoy and Merry Christmas:)

Laisser un commentaire