OIS - Automated System Center Advisor Agent Deployment with Service Management

I recently completed a project where I needed to orchestrate and automate the deployment of System Center Advisor Agents (and pre-requisites) on 228 different Host machines.

PROBLEM SUMMARY:

A recent configuration request required we enable System Center Advisor for a large number of Sales Demo Host machines – This meant that all host machines needed the System Center Advisor Agent (and pre-requisites). I decided to manage this entire configuration request within System Center Service Manager (with full Change and Incident Management). This use case included the following requirements:

  • Infrastructure Configuration Steps:
    • 228 different Hosts
    • 228 different pre-requisite checks
    • 228 command line executions
  • Service Management Configuration Steps:
    • 2 Change Requests
    • 230 different CR to CI associations (2 CR to 1 Software CI and 228 Host CIs)
    • 229 different CI to CI associations (1 Software CI to 228 Host CIs)
    • 228 potential Incident creations (1 IR per issue Host)

That is a lot of configuration steps! In fact, the manual process would require:

  • Individual Login to each Host
  • Hundreds of File Copies and Command Executions
  • Hundreds of CI Associations (as well as CR/IR Creation) in SC Service Manager
  • Thousands of Clicks

RESULT SUMMARY:

This is nothing I wanted to do manually, so I created a set of OIS policies that would handle the work. We now have a set of OIS policies which fully Automate/Orchestrate the deployment of the System Center Advisor Agent on all requested Hosts with full Incident and Change Management in System Center Service Manager.

SOLUTION COMPONENTS:

OIS / SC SERVICE MANAGER SOLUTION SUMMARY:

Policy Created and Executed for each Host: Deploy SC Advisor Agent

  1. Create SW Deploy Change Request (Trigger CR Creation Sub-Policy)
  2. Query for Machines needing System Center Advisor (SQL)
  3. Copy the SCAdvisor.exe file to Host (Copy File object)
  4. Check/Install Pre-Requisite: .NET 3.5 Framework (PowerShell)
    • NOTE: Though this was not required for this use case (as all hosts already had it installed), a Check/Install of the SCOM Agent can easily be added for Hosts without this Pre-Requisite. In fact, I created a separate policy to install the SCOM Agent (with no Management Server identified). If desired, you could call this policy BEFORE the next step (waiting for completion). This example policy will be available in the deliverable below.
  5. Execute Silent Install for SCAdvisor.exe (Run Program object)
  6. Log Success/Failure to SQL Table (for Restart Capabilities)
  7. Cleanup Install File (Delete File object)
  8. Depending on Execution Results:
    • Update/Close CR (Trigger CR Update/Close Sub-Policy)
    • Create Incident, Associate IRs to CR (Trigger IR Creation Sub-Policy)

EXAMPLE OIS POLICY IMAGE (for Infrastructure Configuration Steps):

Maintenance | Install | Deploy SC Advisor Agent
image

EXAMPLE SYSTEM CENTER ADVISOR WEB CONSOLE:
Hosts with newly added Agents start to immediately show up in the SC Advisor Web Console (it may take up to 24 hours for all data to show up) :

image

After enough time has passed, all Agents will show up and start reporting data:

image

EXAMPLE SYSTEM CENTER SERVICE MANAGER CR:
System Center Service Manager now has a new CR with Associated CIs:

image

System Center Service Manager also now has CI (Software) to CI (Host) Relationships on top of the Association with the CR:

image

EXAMPLE OIS POLICY IMAGES (for Service Management Configuration Steps):

Service Management | Change Management | Create Change Request | Software Deployment
image

Service Management | Change Management | Update and Close Change Request
image

Service Management | Incident Management | Create Incident
image

Service Management | Change Management | Relationships | Host Assignment
image

Service Management | Change Management | Relationships | Host to Software
image

Service Management | Change Management | Relationships | Software Assignment
image

Service Management | Change Management | Relationships | User Assignment
image

Service Management | Incident Management | Relationships | IR to CR Assignment
image

Service Management | Incident Management | Relationships | User Assignment
image

EXAMPLE OIS POLICY IMAGE (for Optional Infrastructure Configuration Step - Get SC Advisor Information):
To gather more information about the SC Advisor Agent Deployment on each Host, another policy was created which gathers Registry Information for the installed SC Advisor Agent software, returning: Host, GatewayServer, GatewayID (GatewayID will only be displayed after the Host has connected with the Gateway for the first time).

Maintenance | SC Advisor | Get SC Advisor Information
image

PowerShell to Extract SC Advisor Information

$AdvisorInfo = Get-ChildItem HKLM:\SOFTWARE\Microsoft\SystemCenterAdvisor | ForEach-Object {Get-ItemProperty $_.pspath}

$AdvisorInfo | Select GatewayServer,GatewayID

Log Result Example Host=HOSTNAME1;@{GatewayServer=host1.fqdn; GatewayID={GUIDXXXX-GUID-GUID-GUID-GUIDXXXXXXXX}}
Host=HOSTNAME2;@{GatewayServer=host2.fqdn; GatewayID={GUIDXXXX-GUID-GUID-GUID-GUIDXXXXXXXX}}
Host=HOSTNAME2;@{GatewayServer=host3.fqdn; GatewayID={GUIDXXXX-GUID-GUID-GUID-GUIDXXXXXXXX}}
Host=HOSTNAME2;@{GatewayServer=host4.fqdn; GatewayID={GUIDXXXX-GUID-GUID-GUID-GUIDXXXXXXXX}}

SQL Script for [SCAdvisorAgentInstall] Table Create - Used in Example

CREATE TABLE [dbo].[SCAdvisorAgentInstall]( [VMHost] [nvarchar](50) NULL, [dotNet35FrameworkInstalled] [bit] NULL, [SCOMAgentInstalled] [bit] NULL, [SCAdvisorAgentInstalled] [bit] NULL, [InstallError] [bit] NULL, [Exclude] [bit] NULL, [UpdateDateTime] [datetime] NULL ) ON [PRIMARY]

EXAMPLE OIS SOLUTION RELEASE:

Because this solution includes quite a few policies, command line scripts, PowerShell, and MSSQL tables and Service Manager object configurations, I have packaged it all up as a CodePlex project release (sanitized OIS_EXPORT - in fact, I took out all the “XXDEMO” references for the objects and variables).you are interested, you can find the export here: https://opalis.codeplex.com/releases/view/69721 (OIS - SC Advisor Deployment with SM Kit 1.0)

Pre-requisites for Example:

I want to be clear, you should use these policies as examples. You will not be able to simply import them and click “Start”. The export is from the working set of policies that I created for a specific the environment. I have made them as dynamic as possible (even utilizing external data persistence in MSSQL), but still, your mileage will vary. In fact, the environment that I currently run (and ran this in) is OIS 6.3 installed on Windows Server 2003 x86 (to keep the PowerShell simple). All policies were built to automate/orchestrate against Windows Server 2008 R2 (many with SP1) machines.

DISCLAIMER: The project artifacts within the above referenced CodePlex project is currently compatible and tested against OIS 6.3 installed on Windows Server 2003 x86. Newer versions of OIS and/or the Windows OS where OIS is installed may require that these artifacts need to be updated to accommodate. This solution is AS IS, is not specifically supported and you should use it at your own risk. Please be aware of the impact each policy has on the intended targets before testing. ALWAYS use a test environment to vet your OIS projects.

Anyway, I hope this was useful. If anything it should give you yet another idea on how you could use OIS in your datacenter. :)

enJOY!