-
Notifications
You must be signed in to change notification settings - Fork 82
/
RandomHoliday.ps1
52 lines (48 loc) · 1.87 KB
/
RandomHoliday.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#Grabs a Unique Holiday. - @gwblok
if ((Test-NetConnection "www.checkiday.com").PingSucceeded)
{
[xml]$Events = (New-Object System.Net.WebClient).DownloadString("https://www.checkiday.com/rss.php?tz=America/Chicago")
if ($Events)
{
$EventNames = $Events.rss.channel.item.description
#Pick Random Calendar Event
[int]$Picker = Get-Random -Minimum 1 -Maximum $EventNames.Count
$EventPicked = ($EventNames[$Picker]).'#cdata-section'
Write-Output $EventPicked
}
else
{
Write-Output "No Special Events today"
}
}
else
{
Write-Output "Can't Connect to Website"
}
#Set Fun Version in CM Console for the Uploaded Media - Checks for "Holiday" and uses that. - @gwblok
#This is modified to use part of the Holiday Name in my Output. Just an example of something you could use it for.
if ((Test-NetConnection "www.checkiday.com").PingSucceeded)
{
[xml]$Events = (New-Object System.Net.WebClient).DownloadString("https://www.checkiday.com/rss.php?tz=America/Chicago")
if ($Events)
{
$EventNames = $Events.rss.channel.item.description
#Pick Random Calendar Event
[int]$Picker = Get-Random -Minimum 1 -Maximum $EventNames.Count
$EventPicked = ($EventNames[$Picker]).'#cdata-section'
$VersionName = ($EventPicked.Replace("Today is ","")).replace(" Day!"," Edition")
if($VersionName.Contains('National')) {$VersionName = $VersionName.Replace("National","")}
Write-Output "OSD Builder TS Version: $VersionName"
}
else
{
$VersionName = "BYO ISO Edition"
Write-Output "No Special Events today, defaulting to generic"
}
}
else
{
Write-Output "Can't Connect to Website"
$VersionName = "BYO ISO Edition"
Write-Output "No Special Events today, defaulting to generic"
}