Last active
October 6, 2015 13:22
-
-
Save vikdork/227da9a7d8c41b4ec33d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get-rssfeed | |
{ | |
param( | |
[switch]$Export_CSV, | |
[string]$Filepath, | |
[parameter(mandatory=$true)] | |
[string]$url | |
) | |
$rss = Invoke-RestMethod -Uri $url | |
if ($Export_CSV -eq $true) | |
{ | |
if ($filepath.Length -lt 3) | |
{ | |
$rss | Select-Object title, link | Export-Csv C:\Temp\rss.csv -NoTypeInformation | |
Write-Host "RSS-feed vas exported to C:\Temp\rss.csv" -ForegroundColor Yellow | |
$rss | Select-Object title, link | |
} | |
else | |
{ | |
$rss | Select-Object title, link | Export-Csv $filepath -NoTypeInformation | |
Write-Host "RSS-feed vas exported to $filepath" -ForegroundColor Yellow | |
$rss | Select-Object title, link | |
} | |
} | |
else | |
{ | |
$rss | Select-Object title, link | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment