Beyond Impact Blog

← Back to All Posts

Using MomCertImport.exe  in a Powershell Workflow to Automate Certificate Deployment on SCOM Gateways

Posted on November 09, 2017 by Cole McDonald
In my continuing efforts to fully automate a SCOM environmental deployment, I've been tackling how to go about automating registering the SCOM gateways to the Management Server Pool.  I've got most of the process done, but the certificate registration has tried to elude me as the MOMcertImport tool doesn't work directly from Powershell.  Luckily, Powershell allows us to work around that using the Start-Process cmdlet to run an executable application in its own cmd.exe instance.
 
This requires that during the install, you're copying the MOMCertImport.exe file into your installed Gateway directory on your Gateway Server.  It also assumes that you've already acquired a .pfx file from a Certificate Authority and placed it somewhere useful.
 
 
WIthout further ado, here's the way to run MOMCertImport from Powershell (as always, note the backticks for readability):
 
$appPath = 'C:\Program Files\System Center Operations Manager\Gateway\MOMCertImport.exe'
$args = @(
    "C:\Path\To\Certificate.pfx"
    "/password yourCertPassHere"
)
Start-Process `
    -FilePath $appPath `
    -verb runas `
    -Wait `
    -ArgumentList $args

------------------------------------------------------------------------

Did you find this article useful?  Let me know at cole.mcdonald@beyondimpactllc.com

If you want to be kept informed, follow our RSS feed: http://blog.beyondimpactllc.com/blog/rss.xml

Learn more about PowerShell in Azure

Beyond Impact is a Cloud Hosting and Managed Services provider based in Minneapolis, Minnesota. 
You can learn more about our Cloud Services at beyondimpactllc.com/azure-services/.

Subscribe to Email Updates