MSEndpointMgr

Install Prerequisites for SCOM 2012 with PowerShell

For the past 4 days I’ve been diving myself into System Center 2012 Operations Manager. I had the opportunity to participate in a course held at CornerStone here in Stockholm. During my first day I learned how to install SCOM 2012 and it’s prerequisites. During the day I had some extra time to quickly ease up the prerequisite installation part by writing a short PowerShell script, and I figured that I’d share it here on the blog.

Running the script

Basically you’ll run this on either your ManagementWeb Console or Operations Console server to-be, perhaps you want to install everything on a single box. The script handles that too. It’s important to note that the script will only install the prerequisites required for SCOM 2012 SP1 running on Windows Server 2012. When the script is done installing all prerequisites, it will then restart.
First you have to save the script below to a file, e.g. InstallSCOMPrereq.ps1. Then open a PowerShell prompt and browse your way to where you stored the file. Type the following:

To install prerequisites for a Management Server:

.\InstallSCOMPrereq.ps1 -Role ManagementServer

To install prerequisites for an Operations Console:

.\InstallSCOMPrereq.ps1 -Role OperationsConsole

 To install prerequisites for a Web Console:

.\InstallSCOMPrereq.ps1 -Role WebConsole

 To install prerequisites for all SCOM roles:

.\InstallSCOMPrereq.ps1 -Role AllRoles
24_1

The script

# The script will install all prerequisites for all SCOM 2012 SP1 roles on Windows Server 2012.
# Author: Nickolaj Andersen
# Version: 1.0.3
# Date: 2013-03-21
param(

[parameter(Mandatory=$true)]

$Role) function infoText { Write-Host “##########################################################################” Write-Host “” Write-Host “This will install all prerequisites for a SCOM 2012 SP1 Management Server.” Write-Host “Once the installation is complete, the server will automaticall reboot.” Write-Host “” Write-Host “##########################################################################” Write-Host “” Pause Write-Host “” } function InstalldotNet35 { Write-Host “Installing: .NET Framework 3.5” Add-WindowsFeature NET-Framework-Core | Out-Null } function InstallWCFeatures { Import-Module ServerManager $components = @(“NET-Framework-Core”,”AS-HTTP-Activation”,”Web-Static-Content”,”Web-Default-Doc”,”Web-Dir-Browsing”,”Web-Http-Errors”,”Web-Http-Logging”,”Web-Request-Monitor”,”Web-Filtering”,”Web-Stat-Compression”,”AS-Web-Support”,”Web-Metabase”,”Web-Asp-Net”,”Web-Windows-Auth”) $components | % { Write-Host “Installing:” $_ Add-WindowsFeature $_ | Out-Null } } function InstallReportViewer { $dlfolder = “C:\Install” if (!(Test-Path -path $dlfolder)) { Write-Host $dlfolder “not found, creating it.” New-Item $dlfolder -type directory } $object = New-Object Net.WebClient $RPUrl = ‘https://download.microsoft.com/download/E/A/1/EA1BF9E8-D164-4354-8959-F96843DD8F46/ReportViewer.exe’ Write-Host “Downloading: ReportViewer.exe” $object.DownloadFile($RPUrl, “$dlfolder\ReportViewer.exe”) Write-Host “Installing: Report Viewer 2010” Start-Process -FilePath “$dlfolder\ReportViewer.exe” -ArgumentList /q -Wait } $ProgressPreference = “SilentlyContinue” $WarningPreference = “SilentlyContinue” if (($Role -eq “ManagementServer”) -OR ($Role -eq “OperationsConsole”)) { infoText InstallReportViewer InstalldotNet35 } elseif ($Role -eq “WebConsole”) { infoText InstallReportViewer InstallWCFeatures } elseif ($Role -eq “AllRoles”) { infoText InstallReportViewer InstallWCFeatures } else { Write-Host “Wrong Role selected.” } Write-Host “” Write-Host “Prerequisites installation complete, restarting server.” $ProgressPreference = “Continue” $WarningPreference = “Continue” shutdown /r /t 1 | Out-Null

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

5 comments

  • Hi Nickolaj,
    Firstly I tried with . \InstallSCOMPrereq.Ps1 -Role OperationsConsole
    but Powershell does not recognize it.
    When I running above script(On Azure VM).I am getting
    PS C:\> D:\script\InstallSCOMPrereq.ps1
    cmdlet Untitled1.ps1 at command pipeline position 1
    Supply values for the following parameters:
    Role:
    And when I putting any value in it my system getting restart.
    Please help me out.
    Regards
    Shakti Ranjan

    • Hi Joel,
      Unfortunately not, I’ve not updated the OpsMgr 2012 script I created a while back. As for now I don’t have any plans on doing that either.
      Regards,
      Nickolaj

  • Hi ,
    j’ai ce message d’erreur lorsque je fini d’installer suivant votre procédure,
    pouvez vous m’aider à régler ce problème svp
    Date : 08/11/2013 17:51:51
    Application : Operations Manager
    Version de l’application : 7.0.9538.0
    Gravité : Erreur
    Message :
    Microsoft.EnterpriseManagement.Common.LocationObjectNotFoundException: The pool managing the instance is not available or the location monitoring object cannot be found.
    à Microsoft.EnterpriseManagement.Common.Internal.ServiceProxy.HandleFault(String methodName, Message message)
    à Microsoft.EnterpriseManagement.Common.Internal.AdministrationServiceProxy.LaunchDiscovery(Guid batchId, IList`1 jobDefinitions)
    à Microsoft.EnterpriseManagement.Administration.ManagementServer.BeginExecuteWindowsDiscovery(IList`1 discoveryConfigurations, AsyncCallback callback, Object state)
    à Microsoft.EnterpriseManagement.Mom.Internal.UI.Administration.DiscoveryProgress.c__DisplayClass7.b__3(Object , ConsoleJobEventArgs )
    à Microsoft.EnterpriseManagement.Mom.Internal.UI.Console.ConsoleJobExceptionHandler.ExecuteJob(IComponent component, EventHandler`1 job, Object sender, ConsoleJobEventArgs args)

    • Hi,
      Since I don’t speak french, I’m not really sure what the problem is here. Are you trying to install OpsMgr?
      Regards,
      Nickolaj

Sponsors

Categories

MSEndpointMgr.com use cookies to ensure that we give you the best experience on our website.