Instantly share code, notes, and snippets.

What would you like to do?
# Install the Microsoft MVP PowerShell Module
# Install-Module -name MVP
Import-Module -Name MVP
# my Subscription Key obtained from
$subkey = '12345669b3c459bb2c11da79567890'
# AuthN to MVP API
Set-MVPConfiguration -SubscriptionKey $subkey
# Get the last Blog Post
$wordpressBlogURL = '<yourwordpressURL>/posts/?number=1'
$BlogPostData = Invoke-RestMethod -uri $wordpressBlogURL
# Static because it is obviously a Blog Post
$contributionType = "Blog Site Posts"
# Static as that is my MVP Category
$contributionTechnology = "Identity and Access"
$contributionURL = $BlogPostData.posts.URL
# Title
$contributionTitle = $BlogPostData.posts.title
# Description
$descriptionHTML = $BlogPostData.posts.excerpt
# Remove HTML Formatting
$contributionDescription = $descriptionHTML -replace '<[^>]+>',''
# Translate Date Format
$date = $
$arrDate = $date.Split("T")
$contributionDate = $arrDate[0].Replace("-","/")
# Submit latest Blog Post to MVP Community Contributions Profile
try {
write-host "Submitting your Blog Post titled $($contributionTitle) you wrote on $($contributionDate) to $($contributionTechnology)"
New-MVPContribution -StartDate $contributionDate `
-ContributionTechnology $contributionTechnology `
-ContributionType $contributionType `
-Title $contributionTitle `
-Description $contributionDescription `
-ReferenceUrl $contributionURL `
-Visibility EveryOne } catch {
write-host "Well that was unexpected. Check your last post for anomolies."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment