Over the last few days, I’ve been playing with the OMSSearch PowerShell / SMA / Azure Automation Module my friend and fellow SCCDM MVP Stanislav Zhelyazkov has created. I am now part of this project on Github and have become the 3rd contributor (after Stan and Stefan Stranger). The module was updated yesterday (version 5.1.1) with some of my updates. Today, I have written a sample runbook: Invoke-OMSSavedSearch. As the name suggests, it performs a user defined saved search. Note: due to the limitation of the OMS Search API, we can only retrieve the user defined saved searches. Therefore you
Introduction This is the 3rd instalment of the Automating OpsMgr series. Previously on this series: Automating OpsMgr Part 1: Introducing OpsMgrExtended PowerShell / SMA Module Automating OpsMgr Part 2: SMA Runbook for Creating ConfigMgr Log Collection Rules Today, I will demonstrate a rather simple runbook to create a blank management pack in the OpsMgr management group. Additional, I will also demonstrate executing this runbook not only on your On-Premise Service Management Automation (SMA) infrastructure, but also from an Azure Automation account via Hybrid Workers. Since the Hybrid Worker is a very new component in Azure Automation, I will firstly give
Background Previously, I have posted how to build your own Microsoft OpsMgr MP Catalog on SharePoint 2013 using SMA. It is a solution that you can implement on-prem in your own environment if you have existing SharePoint 2013 and SMA infrastructure in place. As I mentioned at the end of the previous post, I have also developed a solution to populate this MP catalog on a Office 365 SharePoint Online site using Azure Automation – a 100% cloud based solution. Because of the differences in APIs between on-prem SharePoint 2013 and SharePoint online, one of the runbooks is completely different
Over the last couple of days, I’ve spent sometime on Azure Automation (SMA in Azure). The first thing I did was imported and configured the SendEmail and SendPushNotification SMA Integration Modules that I have posted earlier. I created a simple test runbook to send an email and a push notification to my android phone:
#Get the contact details
$ContactName = 'tyang'
Write-Verbose "Getting SMA Address Book entry for $ContactName"
$Contact = Get-AutomationConnection -Name $ContactName
Write-Verbose "Contact: $Contact"
#Get SMTP settings
Write-Verbose "Getting SMTP configuration"
$SMTPSettings = Get-AutomationConnection -Name 'GmailSMTP'
$Subject = "Test message from Azure Automation"
$Message = "Hello, this is a test message from Azure Automation."
Write-Verbose 'Sending email'
$Send = Send-Email -SMTPSettings $SMTPSettings -To $Contact.Email -Subject $Subject -Body $Message -HTMLBody $false
#Android Push Notification
Write-Verbose 'Sending Android push notification'
Send-MobilePushNotification -os "Android" -apikey $Contact.AndroidAPI -Subject $Subject -Application 'Azure Automation' -Body $Message
However, I found 2 issues related to the SendEmail module. I’ll go through both of the issues in this post. Issue 1 When I executed this runbook, it failed to send the email message. I got this error: Cannot find the ‘Send-Email’ command. If this