Jul
16
2010

SCSM – Cumulative Update 1 Error

We have installed the CU1 into the production environment today after rolling out into test yesterday…..

A few of the analysts had the following errors.

During the install they get the following error

CU1 Install Error

Opening up the error log revealed…..

CU1 Install Log

This directs you to a detailed application setup log…shown below..

CU1 Detailed Install Log

From the detailed log this highlighted that the product version was still at Product Version 7.0.5813.0, this was then upgraded to the latest released version and the CU1 applied successfully :-) Happy Days

number of view: 39
0
Jul
16
2010

SCSM – Multiple Self Service Portals on the same web server

So the next challenge steps up to the plate….. with multiple clients all taking the Managed ServiceDesk service from us, either as a dedicated hosted instance or as part of a multi tenanted environment, I needed to provide multiple branded self service portals on the same server, utilising the multi tenanted SCSM instance.

So here’s the highlevel steps I followed,

I built a brand new VM for use as a Web Server, installed the OpSys, AntiVirus made sure it was fully patched, installed all the prerequisites etc etc

  • I installed the SCSM Portal on the server as per the deployment guide.
  • I then copied the SCSM Portal folder to the same folder with a different name
  • Added a new site in IIS and assigned it to the same Application Pool in IIS Manager
  • Changed the logo’s on the new site, removed the links for request password and request software as we are not ready for them yet
  • I then removed the contact IT button from the aspx page’s as per my previous blog here
  • I then assigned the new site a different internal IP

….and hey presto two SCSM Portal sites with different branding, the contact IT button’s removed running on the same server but pointing to the same instance :-)

number of view: 65
0
Jul
15
2010

SCSM – Removing the ContactIT Button from the Self Service Portal

Working for a Managed Services Provider, I needed to overcome some of the “out of the box” functionality of SCSM as we are currently using Service Manager as the workhorse for our Managed ServiceDesk offering.

So came the challenge, with multiple clients all taking the service from us, either as a dedicated hosted instance or as part of a multi tenanted environment, I needed to remove the ContactIT button from the Self Service Portal and have separate branding for each client… there logos etc… ( blogged here).

Anyway back to the challenge in hand, I needed to remove the ContactIT button from the Self Service Portal, and according to the technet forum posts, and the feedback on the Connect site, it didn’t look easy, or even at all possible….. but it actually turned out to be only a few lines of code changed.

So the following bit of code needs to be removed from the ServiceManagerPortal.Master, from the ServiceManagerCommandMaster.Master as well as from the relevant *.aspx files in the End User directories of the self service portal.

The *.aspx files for the End User Portal are located in \System Center Service Manager Portal\EndUser’ and the *.Master files are in \System Center Service Manager Portal\EndUser\MasterPages\

<asp:WebPartZone ID=”WebPartZone1″ runat=”server” BorderWidth=”0px” BorderStyle=”None”

PartTitleStyle-CssClass=”orangletitle” Width=”100%” PartChromeType=”None”>

<PartTitleStyle CssClass=”orangeTitleLeftAligned”></PartTitleStyle>

<ZoneTemplate>

<SM_WebParts:GlobalLinks ChromeType=”None” runat=”server”

Title=” ” />

</ZoneTemplate>

<MinimizeVerb Text=”<%$ Resources:EndUserPortalResources, MinimizeWebPart %>” />

</asp:WebPartZone>

So once the following changes have been made to the relevant files if you load the self service portal into you internet browser, the ContactIT Button has been removed…. Happy Days

number of view: 31
0
Jul
12
2010

iPad WordPress App

Tags: ,

Just downloaded and installed the word press app to my iPad, very straight forward, easy to setup, use etc, this is the first post

number of view: 33
0
Jul
05
2010

VMWare – Using SCP to copy files to or from ESX

Tags: , ,

Details

What is the best utility to use when I copy files to or from an ESX Server system?

Solution

Important: If you are moving virtual disk files, see http://kb.vmware.com/kb/900.
VMware recommends that you use SCP to copy files to or from ESX Server systems. The ESX Server installation includes SCP as part of the SSH package.

To copy a file from the ESX Server system to another server, use the following syntax:

scp local_filename user@server:/path/where/file/should/go

All machines to which you copy files must also have SSH (which includes SCP) installed and configured, and be available on the same network.Many Linux and Unix distributions include SSH and SCP. If you need to download the software, seewww.openssh.com. For a list of Windows clients, see http://www.openssh.com/windows.html.

In some situations, you may need to use SCP without a password prompt. For more information, seehttp://kb.vmware.com/kb/1719.
Finally, if you must use FTP, you need to enable its use in the ESX Server system. For details, seehttp://kb.vmware.com/kb/1868.
number of view: 31
0
Jul
05
2010

SCSM – Restart the Numbering

So you have entered loads of test data and you now wish to start the numbering from scratch….. with a little help from sql this can be achieved, however its  Not supported, not tested, not recommended.

The table is AutoIncrementAvailableRange.

The type id is from the ManagedType table,

The property type id is from the ManagedTypeProperty table.

number of view: 31
0
Jul
05
2010

SCSM – Deleting Work Items via Powershell

Taken from Jim’s Blog http://jtruher.spaces.live.com/blog/cns!7143DA6E51A2628D!843.entry?sa=742284781

Sometimes, when I am developing a demo for Service Manager, I wind up creating a lot of Service Requests or Incidents when I’m trying to get the demo just right. However, after I’ve gotten everything working just like I want and then I give the demo, I don’t really want to have all those earlier things visible because they get in the way of the what I’m trying to show. The Service Manager 2010 provides a way to removing instances from the console, and I could use that, but I like to script everything so I want to create a script instead of using the UI. With this script, I can use this to remove any instance in the CMDB, including Incidents and Service Requests.

Our programming interfaces provide a way to remove instances and I’ve written my script to work a couple of ways:

  • If you provide the script with  ClassName parameter, the script will remove every instance of that class!
  • If you pipe an EnterpriseManagementObject at the script, the script will remove that instance

These are pretty big hammers, so I’ve made sure that you can use –WhatIf and I’ve also set ConfirmImpact as High which will ask for confirmation even if you don’t specify –confirm. My last warning is that you should not put this script anywhere near your production machines. It will remove the data forever, so be sure you are careful!!

I think the most interesting bit of the script is on line 21. This is where an IncrementalDiscoveryData object is created. The IncrementalDiscoveryData object allows you to deal with instances in bulk.  I can use this object to remove instances then remove them all by the single call to Commit in line 73.  The code between lines 29 and 35 represent the code that’s needed to call our generic methods, the script uses reflection to build the generic method and then call it.

The PROCESS block starting on line 50 handles the case when you pipe objects to the script. It first checks to be sure that it’s an EnterpriseManagementObject, and if so, adds the object to the IncrementalDiscoveryData collection which will be used in the END block. Rather than wrapping the call to Commit in another ShouldProcess block, I just check to be sure I have objects to remove. If there are, I make the Commit call. I don’t like it when my scripts ask me “Do you really want to do this” after I’ve already answered it once.

This script is a PowerShell version 2.0 script (as seen in line 1). This way I can take advantage of the ConfirmImpact and the other PowerShell 2.0 goodies.

#requires -version 2.0
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="High")]
param (
[Parameter(Position=0)]
$classname,
[Parameter(ValueFromPipeline=$true)]$EMO
)
BEGIN
{
# oh for a way to specify namespaces
$NS = ”Microsoft.EnterpriseManagement”
if ( ! (“${NS}.Common.EnterpriseManagementObject” -as ”type”))
{
[reflection.assembly]::LoadWithPartialName(“${NS}.Core”)
}

$LFX          = ”ConnectorFramework”
$DEFAULT      = (“${NS}.Common.ObjectQueryOptions” -as ”type”)::Default
$EMOT         = ”${NS}.Common.EnterpriseManagementObject” -as ”type”
$EMG          = new-object ”${NS}.EnterpriseManagementGroup” localhost
$IDD          = new-object ”${NS}.${LFX}.incrementaldiscoverydata”
$guid         = $EMG.ConnectorFramework.GetDefaultConnectorId().guid
$SDKConnector = $EMG.ConnectorFramework.GetConnector($guid)
$REMOVECOUNT  = 0
# only go through this process if you got a classname and are
# going to remove all instances of that class
if ( $classname )
{
$IMgmt    = $EMG.EntityObjects.GetType()
$class = $EMG.EntityTypes.GetClasses()|?{$_.name -eq $classname}
[array]$arguments = ($class -as ”${NS}.Configuration.ManagementPackClass”),$DEFAULT
[type[]]$TYPES = (“${NS}.Configuration.ManagementPackClass” -as ”type”),
(“${NS}.Common.ObjectQueryOptions” -as ”type”)
$ObjectReader = $IMgmt.getmethod(“GetObjectReader”,$TYPES)
$GenericMethod = $ObjectReader.MakeGenericMethod($EMOT)
if ( ! $class ) { throw ”no class $classname” }
# GET THE OBJECTS
$SMObjects = $GenericMethod.invoke($EMG.EntityObjects,$arguments)
if ( ! $SMObjects ) { ”No objects to remove”; exit }
$SMObjects|%{
if ( $PSCmdlet.ShouldProcess( $_.displayname ) )
{
$REMOVECOUNT++
$IDD.Remove($_)
}
}
}
}

PROCESS
{
if ( $EMO -is ”${NS}.Common.EnterpriseManagementObject”)
{
if ( $PSCmdlet.ShouldProcess( $EMO.displayname ) )
{
$REMOVECOUNT++
$IDD.Remove($EMO)
}
}
elseif ( ! $EMO ) { ; }
else
{
Write-Error ”$_ is not an EnterpriseManagementObject, skipping”
}
}

END
{
# only actually call this if there are any to delete
if ( $REMOVECOUNT )
{
Write-Verbose ”Committing Changes”
$IDD.Commit(${SDKConnector})
}
}

<#
.SYNOPSIS
Remove an instance from the Service Manager 2010 CMDB
.DESCRIPTION
The cmdlet removes instances from the Service Manager CMDB.
If the classname parameter is provided, every instance will
be removed from the CMDB.
Optionally, instances may be piped to this cmdlet in which case
only those instances will be removed.
.PARAMETER ClassName
A Service Manager 2010 class name
.PARAMETER EMO
An instance to be removed from the Service Mangaer 2010 CMDB
.EXAMPLE
remove-smobject -classname Microsoft.Windows.Computer
Removes all instances of Microsoft.Windows.Computer from the
Service Manager 2010 CMDB
.EXAMPLE
get-smobject Microsoft.Windows.Computer | ?{$_.displayname -match “Computer00″}|remove-smobject
Removes all instances of Microsoft.Windows.Computer from the
Service Manager 2010 CMDB where the displayname matches “Computer00″
.INPUTS
Output from get-smobject
Any EnterpriseManagementObject
.OUTPUTS
None
.LINK
get-smobject-ManagementPack
get-smclass
#>

If you run the following it will show you all the incident parameters

‘\get-smobject.ps1 System.WorkItem.Incident

or simply run

Run “.\get-smobject.ps1 System.WorkItem.Incident | .\remove-smobject.ps1 -whatif”.

-whatif will show you what it would delete if you did not have the -whatif command

number of view: 40
0
Jul
05
2010

SCOM – How to Move the OperationsManager Database in Operations Manager 2007

Taken from http://technet.microsoft.com/en-us/library/cc540384.aspx

Use the procedure below to move the OperationsManager database to a new server.

To move the OperationsManager database

  1. Install and configure a new SQL Server-based computer. Ensure that you have system administrator permissions on both the original SQL Server-based computer and the new SQL Server-based computers.
  2. Back up the following:
    • Back up all databases. On the current server that hosts the Operations Manager database, use SQL Server Management Studio to back up the Operations Manager (default name) database.
    • Back up the encryption key on the root management server by using the SecureStorageBackup.exe utility.
  3. Stop the Operations Manager services (System Center Management, System Center Data Access, and System Center Management Configuration for root management servers, and System Center Management for management servers) on the management servers in the management group.

    In a clustered root management server environment, use Cluster Administrator (Windows Server 2003) or Failover Cluster Management (Windows Server 2008) to configure each of the three services listed above with the Take Offline option.

  4. On the current server that hosts the OperationsManager database, uninstall the database component as follows (these steps do not physically remove the OperationsManager database from SQL Server):
    noteNote
    Perform this step if the database is the only component on the server. Otherwise, you will still be able to delete the database following the next step.
    1. Click Start, click Control Panel, and then click Add or Remove Programs for Windows Server 2003 or Programs and Features for Windows Server 2008.
    2. In the Add or Remove Programs dialog box for Windows Server 2003 or Programs and Features dialog box for Windows Server 2008, select System Center Operations Manager 2007 R2, and then select Remove for Windows Server 2003 or select Uninstall for Windows Server 2008.
    3. Complete the wizard.
  5. On the current server that hosts the OperationsManager database, delete the OperationsManager database as follows:
    1. In Microsoft SQL Server Management Studio, navigate to Databases.
    2. Right-click OperationsManager, and then click Delete.
    3. In the Delete Object dialog box, ensure that the Delete backup and restore history information for databases and Close existing connections options are both selected.
    4. Click OK to complete the operation.
  6. On the new server, use Microsoft SQL Server Management Studio to restore the OperationsManager database that you previously backed up. To access the database backup file, copy the backup file to a local drive or map a local drive to the folder that contains the backup file.
  7. Update the registry on each management server in the management group to reference the new SQL Server-based computer. Complete this step also on the root management server. If the root management server is clustered, you must complete this step on all the nodes in the cluster.
    noteNote
    Before editing the registry, follow your site’s backup policies with regard to the registry.
    1. Log on to the management server with Administrator permissions.
    2. Click Start, select Run, type regedit in the Open box, and then click OK to start Registry Editor.
    3. Under HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft Operations Manager\3.0\Setup, double-click the value DatabaseServerName, and then change the value to the hostname of the SQL Server-based computer now hosting the OperationsManager database.
    4. Click OK.
    5. Close the Registry Editor.
    6. After you have completed this step on all management servers in the management group, restart the System Center Management, System Center Data Access, and System Center Management Configuration services on the root management server, and then restart only the System Center Management service on the remaining management servers.
      ImportantImportant
      Do not start the System Center Management Configuration and System Center Data Access services on the management servers, as these services should be running only on the root management server.
  8. Update the OperationsManager database with the New Database Server Name, and ensure that the account that you are logged on with has sufficient privileges on the SQL Server instance.
    1. Open SQL Server Management Studio.
    2. Expand DatabasesOperationsManager, and Tables.
    3. Right-click dbo.MT_ManagementGroup, and then click Open Table if you are using SQL Server 2005 or click Edit Top 200 Rows if you are using SQL Server 2008.
    4. Change the value in the SQLServerName_6B1D1BE8_EBB4_B425_08DC_2385C5930B04 column to reflect the name of the new SQL Server-based computer.
    5. Save your change.
  9. On the new server hosting the OperationsManager database, add the correct permission for the login of the root management server on which the SDK Account is running, as follows:
    1. Open Microsoft SQL Server Management Studio, and in the Object Explorer pane, navigate to Security and then expand Logins.
    2. Locate the SDK Account, and add the account if it is not listed.
      noteNote
      If the SDK Account is running as LocalSystem, use the format <domain\computername$> in SQL Logins, where <computername> is the name of the root management server.
    3. Right-click the SDK Account, and select Properties.
    4. In the Login Properties dialog box, in the Select a page pane, select User Mapping.
    5. In the Users mapped to this login list, in the Map column, select the box that corresponds to OperationsManager (default name).
    6. In the Database role membership for: OperationsManager list, ensure that the following items are selected: configsvc_usersdb_datareaderdb_datawriterdb_ddladmin, and sdk_users.
    7. Click OK to save your changes and to close the Login Properties dialog box.
  10. On the new server hosting the Operations Manager database, add the correct permission for the login of the root management server on which the Action Account is running, as follows:
    1. Open Microsoft SQL Server Management Studio, and in the Object Explorer pane, navigate to Security and then expand Logins.
    2. Locate the Action Account, and add the account if it is not listed. If the Action Account is running as LocalSystem, use the format <domain\computername$> in SQL Logins, where <computername> is the name of the root management server.
    3. Right-click the Action Account, and select Properties.
    4. In the Login Properties dialog box, in the Select a page pane, select User Mapping.
    5. In the Users mapped to this login list, in the Map column, select the box that corresponds to OperationsManager (default name).
    6. In the Database role membership for: OperationsManager list, ensure that the following items are selected: db_datareaderdb_datawriterdb_ddladmin, and dbmodule_users.
    7. Click OK to save your changes and to close the Login Properties dialog box.
  11. On the new server hosting the Operations Manager database, add the correct permission for the login of the Data Warehouse server on which the Data Warehouse Action Account is running, as follows:
    1. Open Microsoft SQL Server Management Studio, and in the Object Explorer pane, navigate to Security and then expand Logins.
    2. Locate the Data Warehouse Action Account, and add the account if it is not listed.
    3. Right-click the Data Warehouse Action Account, and select Properties.
    4. In the Login Properties dialog box, in the Select a page pane, select User Mapping.
    5. In the Users mapped to this login list, in the Map column, select the box that corresponds to OperationsManager (default name).
    6. In the Database role membership for: OperationsManager list, ensure that the following items are selected: db_datareader and dwsynch_users.
    7. Click OK to save your changes and to close the Login Properties dialog box.

Use the procedure below to move the OperationsManager database to a new server.

To move the OperationsManager database

  1. Install and configure a new SQL Server-based computer. Ensure that you have system administrator permissions on both the original SQL Server-based computer and the new SQL Server-based computers.
  2. Back up the following:
    • Back up all databases. On the current server that hosts the Operations Manager database, use SQL Server Management Studio to back up the Operations Manager (default name) database.
    • Back up the encryption key on the root management server by using the SecureStorageBackup.exe utility.
  3. Stop the Operations Manager services (System Center Management, System Center Data Access, and System Center Management Configuration for root management servers, and System Center Management for management servers) on the management servers in the management group.

    In a clustered root management server environment, use Cluster Administrator (Windows Server 2003) or Failover Cluster Management (Windows Server 2008) to configure each of the three services listed above with the Take Offline option.

  4. On the current server that hosts the OperationsManager database, uninstall the database component as follows (these steps do not physically remove the OperationsManager database from SQL Server):
    noteNote
    Perform this step if the database is the only component on the server. Otherwise, you will still be able to delete the database following the next step.
    1. Click Start, click Control Panel, and then click Add or Remove Programs for Windows Server 2003 or Programs and Features for Windows Server 2008.
    2. In the Add or Remove Programs dialog box for Windows Server 2003 or Programs and Features dialog box for Windows Server 2008, select System Center Operations Manager 2007 R2, and then select Remove for Windows Server 2003 or select Uninstall for Windows Server 2008.
    3. Complete the wizard.
  5. On the current server that hosts the OperationsManager database, delete the OperationsManager database as follows:
    1. In Microsoft SQL Server Management Studio, navigate to Databases.
    2. Right-click OperationsManager, and then click Delete.
    3. In the Delete Object dialog box, ensure that the Delete backup and restore history information for databases and Close existing connections options are both selected.
    4. Click OK to complete the operation.
  6. On the new server, use Microsoft SQL Server Management Studio to restore the OperationsManager database that you previously backed up. To access the database backup file, copy the backup file to a local drive or map a local drive to the folder that contains the backup file.
  7. Update the registry on each management server in the management group to reference the new SQL Server-based computer. Complete this step also on the root management server. If the root management server is clustered, you must complete this step on all the nodes in the cluster.
    noteNote
    Before editing the registry, follow your site’s backup policies with regard to the registry.
    1. Log on to the management server with Administrator permissions.
    2. Click Start, select Run, type regedit in the Open box, and then click OK to start Registry Editor.
    3. Under HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft Operations Manager\3.0\Setup, double-click the value DatabaseServerName, and then change the value to the hostname of the SQL Server-based computer now hosting the OperationsManager database.
    4. Click OK.
    5. Close the Registry Editor.
    6. After you have completed this step on all management servers in the management group, restart the System Center Management, System Center Data Access, and System Center Management Configuration services on the root management server, and then restart only the System Center Management service on the remaining management servers.
      ImportantImportant
      Do not start the System Center Management Configuration and System Center Data Access services on the management servers, as these services should be running only on the root management server.
  8. Update the OperationsManager database with the New Database Server Name, and ensure that the account that you are logged on with has sufficient privileges on the SQL Server instance.
    1. Open SQL Server Management Studio.
    2. Expand DatabasesOperationsManager, and Tables.
    3. Right-click dbo.MT_ManagementGroup, and then click Open Table if you are using SQL Server 2005 or click Edit Top 200 Rows if you are using SQL Server 2008.
    4. Change the value in the SQLServerName_6B1D1BE8_EBB4_B425_08DC_2385C5930B04 column to reflect the name of the new SQL Server-based computer.
    5. Save your change.
  9. On the new server hosting the OperationsManager database, add the correct permission for the login of the root management server on which the SDK Account is running, as follows:
    1. Open Microsoft SQL Server Management Studio, and in the Object Explorer pane, navigate to Security and then expand Logins.
    2. Locate the SDK Account, and add the account if it is not listed.
      noteNote
      If the SDK Account is running as LocalSystem, use the format <domain\computername$> in SQL Logins, where <computername> is the name of the root management server.
    3. Right-click the SDK Account, and select Properties.
    4. In the Login Properties dialog box, in the Select a page pane, select User Mapping.
    5. In the Users mapped to this login list, in the Map column, select the box that corresponds to OperationsManager (default name).
    6. In the Database role membership for: OperationsManager list, ensure that the following items are selected: configsvc_usersdb_datareaderdb_datawriterdb_ddladmin, and sdk_users.
    7. Click OK to save your changes and to close the Login Properties dialog box.
  10. On the new server hosting the Operations Manager database, add the correct permission for the login of the root management server on which the Action Account is running, as follows:
    1. Open Microsoft SQL Server Management Studio, and in the Object Explorer pane, navigate to Security and then expand Logins.
    2. Locate the Action Account, and add the account if it is not listed. If the Action Account is running as LocalSystem, use the format <domain\computername$> in SQL Logins, where <computername> is the name of the root management server.
    3. Right-click the Action Account, and select Properties.
    4. In the Login Properties dialog box, in the Select a page pane, select User Mapping.
    5. In the Users mapped to this login list, in the Map column, select the box that corresponds to OperationsManager (default name).
    6. In the Database role membership for: OperationsManager list, ensure that the following items are selected: db_datareaderdb_datawriterdb_ddladmin, and dbmodule_users.
    7. Click OK to save your changes and to close the Login Properties dialog box.
  11. On the new server hosting the Operations Manager database, add the correct permission for the login of the Data Warehouse server on which the Data Warehouse Action Account is running, as follows:
    1. Open Microsoft SQL Server Management Studio, and in the Object Explorer pane, navigate to Security and then expand Logins.
    2. Locate the Data Warehouse Action Account, and add the account if it is not listed.
    3. Right-click the Data Warehouse Action Account, and select Properties.
    4. In the Login Properties dialog box, in the Select a page pane, select User Mapping.
    5. In the Users mapped to this login list, in the Map column, select the box that corresponds to OperationsManager (default name).
    6. In the Database role membership for: OperationsManager list, ensure that the following items are selected: db_datareader and dwsynch_users.
    7. Click OK to save your changes and to close the Login Properties dialog box.
number of view: 81
0
Jun
30
2010

Mac OS X Maintenance Scripts

Mac® OS X is a UNIX®-based system, built in part on both BSD® and FreeBSD®. UNIX systems run scheduled maintenance routines — known as maintenance scripts — to clean up a variety of System logs and temporary files. By default, these are executed between 03:15 and 05:30 hours local time, depending on the script.

If your Mac is shut down or in sleep mode during these hours, the maintenance scripts will not run. This results in log files that will grow over time, consuming free space on your Mac OS X startup disk.

If your Mac is shut down or left in sleep mode overnight, the maintenance scripts should be run manually on a regular basis… unless you plan on devoting a large portion of your hard drive to the files cleaned-up by these routines!

So To Run Them The Terminal way

Using your Admin account, you can run all three maintenance scripts at once:

  1. Open Terminal, located in the Macintosh HD > Applications > Utilities folder.
  2. At the Terminal prompt, type the following, exactly as written:
    1. sudo periodic daily weekly monthly
  3. Press Return.
  4. Type your Admin password when prompted, then press Return.

All three scripts will run in sequence. There is no visual feedback while the scripts execute. You will know they are completed when the Terminal prompt returns.

You can also run the scripts individually. For example, to run just the daily script, you would type the the following command in step 2:

  • sudo periodic daily

Determining when the maintenance scripts last ran

You can run a Terminal command to quickly check the date and time stamps of the log files associated with each maintenance script. This indicates when the scripts’ logs were last updated, hence when the scripts were last executed.

  1. Open Terminal, located in the Macintosh HD > Applications > Utilities folder.
  2. At the Terminal prompt, type the following, exactly as written:
    1. ls -al /var/log/*.out
  3. Press Return.
number of view: 26
0
Jun
29
2010

SCOM – SQL Queries

–======================================================================

– SQL Source File — Created with SAPIEN Technologies PrimalScript 4.1

– NAME: Useful_SCOM2007_SQL_Queries.sql

– AUTHOR: Jeremy D. Pavleck , JPavleck@GMail.com
– DATE  : 4/17/2008

– COMMENT: Some useful SQL queries you can use in SCOM2007.
– Taken verbatim from Kevin Holman’s OpsMgr Blog, and re-written to be SQL friendly.

– URL: http://blogs.technet.com/kevinholman/archive/2007/10/18/useful-operations-manager-2007-sql-queries.aspx

–======================================================================

– Find all managed servers that are down and not pingable
SELECT bme.DisplayName, s.LastModified
FROM state AS s, BaseManagedEntity AS bme
WHERE s.basemanagedentityid = bme.basemanagedentityid AND s.monitorid
IN (SELECT MonitorId FROM Monitor WHERE MonitorName =‘Microsoft.SystemCenter.HealthService.ComputerDown’)
AND s.Healthstate = ‘3′
ORDER BY s.Lastmodified DESC

– Operational Database Version
SELECT DBVersion FROM __MOMManagementGroupInfo__

– Find a computer name from it’s Health Service ID (guid from agent proxy alerts)
SELECT id, path, fullname, displayname FROM ManagedEntityGenericView WHERE ID =‘<GUID>’

– ALERTS SECTION –
——————–

– Most common alerts, by alert count
SELECT AlertStringName, AlertStringDescription, AlertParams, Name, SUM(1) ASAlertCount, SUM(RepeatCount+1) AS AlertCountWithRepeatCount
FROM Alertview WITH (NOLOCK)
WHERE ResolutionState = (0|255)
GROUP BY AlertStringName, AlertStringDescription, AlertParams, Name
ORDER BY AlertCount DESC

– TOP 10 common alerts
SELECT Top(10) AlertStringName, AlertStringDescription, AlertParams, Name, SUM(1) ASAlertCount, SUM(RepeatCount+1) AS AlertCountWithRepeatCount
FROM Alertview WITH (NOLOCK)
WHERE ResolutionState = (0|255)
GROUP BY AlertStringName, AlertStringDescription, AlertParams, Name
ORDER BY AlertCount DESC

– Most common alerts, by repeat count
SELECT AlertStringName, AlertStringDescription, AlertParams, Name, SUM(1) ASAlertCount, SUM(RepeatCount+1) AS AlertCountWithRepeatCount
FROM Alertview WITH (NOLOCK)
WHERE ResolutionState = (0|255)
GROUP BY AlertStringName, AlertStringDescription, AlertParams, Name
ORDER BY AlertCountWithRepeatCount DESC

– Number of alerts per day
SELECT CONVERT(VARCHAR(20), TimeAdded, 101) AS DayAdded, COUNT(*) AS NumAlertsPerDay
FROM Alert WITH (NOLOCK)
GROUP BY CONVERT(VARCHAR(20), TimeAdded, 101)
ORDER BY DayAdded DESC

– Number of alerts per day by resolution state
SELECT
CASE WHEN(GROUPING(CONVERT(VARCHAR(20), TimeAdded, 101)) = 1) THEN ‘All Days’ ELSE CONVERT(VARCHAR(20), TimeAdded, 101) END AS [Date],
CASE WHEN(GROUPING(ResolutionState) = 1) THEN ‘All Resolution States’ ELSE CAST(ResolutionState AS VARCHAR(5)) END AS [ResolutionState],
COUNT(*) AS NumAlerts
FROM Alert WITH (NOLOCK)
GROUP BY CONVERT(VARCHAR(20), TimeAdded, 101), ResolutionState WITH ROLLUP
ORDER BY DATE DESC

– EVENTS SECTION –
——————–

– Most common events by day by count
SELECT CASE WHEN(GROUPING(CONVERT(VARCHAR(20), TimeAdded, 101)) = 1)
THEN ‘All Days’
ELSE CONVERT(VARCHAR(20), TimeAdded, 101) END AS DayAdded,
COUNT(*) AS NumEventsPerDay
FROM EventAllView
GROUP BY CONVERT(VARCHAR(20), TimeAdded, 101) WITH ROLLUP
ORDER BY DayAdded DESC

– Most common events by event number
SELECT Number, COUNT(*) AS ”Number of Events”
FROM EventView
GROUP BY Number
ORDER BY ”Number of Events” DESC

– PERFORMANCE SECTION –
————————-

– Performance Insertions per day
SELECT CASE WHEN(GROUPING(CONVERT(VARCHAR(20), TimeSampled, 101)) = 1)
THEN ‘All Days’ ELSE CONVERT(VARCHAR(20), TimeSampled, 101)
END AS DaySampled, COUNT(*) AS NumPerfPerDay
FROM PerformanceDataAllView
GROUP BY CONVERT(VARCHAR(20), TimeSampled, 101) WITH ROLLUP
ORDER BY DaySampled DESC

– Most common performance insertions by perf object and counter name:
SELECT pcv.objectname, pcv.countername, count (pcv.countername) AS total FROMperformancedataallview AS pdv, performancecounterview AS pcv
WHERE (pdv.performancesourceinternalid = pcv.performancesourceinternalid)
GROUP BY pcv.objectname, pcv.countername
ORDER BY count (pcv.countername) DESC

– Most common performance insertions by perf object name:
SELECT pcv.objectname, count (pcv.countername) AS total FROM performancedataallviewAS pdv, performancecounterview AS pcv
WHERE (pdv.performancesourceinternalid = pcv.performancesourceinternalid)
GROUP BY pcv.objectname
ORDER BY count (pcv.countername) DESC

– Most common performance insertions by perf counter name:
SELECT pcv.countername, count (pcv.countername) AS total FROM performancedataallviewAS pdv, performancecounterview AS pcv
WHERE (pdv.performancesourceinternalid = pcv.performancesourceinternalid)
GROUP BY pcv.countername
ORDER BY count (pcv.countername) DESC

– STATE SECTION –
——————-

– State changes per day:
SELECT CASE WHEN(GROUPING(CONVERT(VARCHAR(20), TimeGenerated, 101)) = 1)
THEN ‘All Days’ ELSE CONVERT(VARCHAR(20), TimeGenerated, 101)
END AS DayGenerated, COUNT(*) AS NumEventsPerDay
FROM StateChangeEvent WITH (NOLOCK)
GROUP BY CONVERT(VARCHAR(20), TimeGenerated, 101) WITH ROLLUP
ORDER BY DayGenerated DESC

– MANAGEMENT PACK INFO –
————————–

– To find all installed Management Packs and their version:
SELECT MPName, MPFriendlyName, MPVersion, MPIsSealed
FROM ManagementPack WITH(NOLOCK)
ORDER BY MPName

– Rules per MP:
SELECT mp.MPName, COUNT(*) AS RulesPerMP
FROM Rules r
INNER JOIN ManagementPack mp ON mp.ManagementPackID = r.ManagementPackID
GROUP BY mp.MPName
ORDER BY RulesPerMP DESC

– Rules per MP by category:
SELECT mp.MPName, r.RuleCategory, COUNT(*) AS RulesPerMPPerCategory
FROM Rules r
INNER JOIN ManagementPack mp ON mp.ManagementPackID = r.ManagementPackID
GROUP BY mp.MPName, r.RuleCategory
ORDER BY RulesPerMPPerCategory DESC

– Monitors Per MP:
SELECT mp.MPName, COUNT(*) AS MonitorsPerMPPerCategory
FROM Monitor m
INNER JOIN ManagementPack mp ON mp.ManagementPackID = m.ManagementPackID
GROUP BY mp.MPName
ORDER BY COUNT(*) DESC

– To find your Monitor by common name:
SELECT * FROM Monitor
INNER JOIN LocalizedText LT ON LT.ElementName = Monitor.MonitorName
WHERE LTValue = ‘My Monitor Name’

– To find all Rules per MP that generate an alert:
declare @mpid AS varchar(50)
SELECT @mpid= managementpackid FROM managementpack WHERE
mpName=‘Microsoft.BizTalk.Server.2006.Monitoring’
SELECT rl.rulename,rl.ruleid,md.modulename FROM rules rl, module md
WHERE md.managementpackid = @mpid
AND rl.ruleid=md.parentid
AND moduleconfiguration LIKE ‘%<AlertLevel>50</AlertLevel>%’

– To find all rules per MP with a given alert severity:
declare @mpid AS varchar(50)
SELECT @mpid= managementpackid FROM managementpack WHERE
mpName=‘Microsoft.BizTalk.Server.2006.Monitoring’
SELECT rl.rulename,rl.ruleid,md.modulename FROM rules rl, module md
WHERE md.managementpackid = @mpid
AND rl.ruleid=md.parentid
AND moduleconfiguration LIKE ‘%<Severity>2</Severity>%’

– Number of instances of a type:  (Number of disks, computers, databases, etc that OpsMgr has discovered)
SELECT mt.ManagedTypeID, mt.TypeName, COUNT(*) AS NumEntitiesByType
FROM BaseManagedEntity bme WITH(NOLOCK)
LEFT JOIN ManagedType mt WITH(NOLOCK) ON mt.ManagedTypeID = bme.BaseManagedTypeID
WHERE bme.IsDeleted = 0
GROUP BY mt.ManagedTypeID, mt.TypeName
ORDER BY COUNT(*) DESC

– Number of Views per Management Pack:
SELECT mp.MPName, v.ViewVisible, COUNT(*) AS ViewsPerMP
FROM [Views] v
INNER JOIN ManagementPack mp ON mp.ManagementPackID = v.ManagementPackID
GROUP BY  mp.MPName, v.ViewVisible
ORDER BY v.ViewVisible DESC, COUNT(*) DESC

– Grooming:
SELECT * FROM PartitionAndGroomingSettings WITH (NOLOCK)

– All managed computers count:
SELECT COUNT(*) AS NumManagedComps FROM (
SELECT bme2.BaseManagedEntityID
FROM BaseManagedEntity bme WITH (NOLOCK)
INNER JOIN BaseManagedEntity bme2 WITH (NOLOCK) ON bme2.BaseManagedEntityID = bme.TopLevelHostEntityID
WHERE bme2.IsDeleted = 0
AND bme2.IsDeleted = 0
AND bme2.BaseManagedTypeID = (SELECT TOP 1 ManagedTypeID FROM ManagedType WHERETypeName = ‘microsoft.windows.computer’)
GROUP BY bme2.BaseManagedEntityID
) AS Comps

– Classes available in the DB:
SELECT * FROM ManagedType

– Classes available in the DB for Microsoft Windows type:
SELECT * FROM ManagedType
WHERE TypeName LIKE ‘Microsoft.Windows.%’

– Every property of every class:
SELECT * FROM MT_Computer

– All instances of all types once discovered
SELECT * FROM BaseManagedEntity

– To get the state of every instance of a particular monitor the following query can be run, (replace <MonitorName> with the name of the monitor):
SELECT bme.FullName, bme.DisplayName, s.HealthState FROM state AS s, BaseManagedEntity AS bme
WHERE s.basemanagedentityid = bme.basemanagedentityid
AND s.monitorid IN (SELECT MonitorId FROM Monitor WHERE MonitorName =‘<MonitorName>’)

– For example, this gets the state of the Microsoft.SQLServer.2005.DBEngine.ServiceMonitor for each instance of the SQL 2005 Database Engine class.
SELECT bme.FullName, bme.DisplayName, s.HealthState
FROM state AS s, BaseManagedEntity AS bme
WHERE s.basemanagedentityid = bme.basemanagedentityid
AND s.monitorid IN (SELECT MonitorId FROM Monitor WHERE MonitorName =‘Microsoft.SQLServer.2005.DBEngine.ServiceMonitor’)

– To find the overall state of any object in OpsMgr the following query should be used to return the state of the System.EntityState monitor:
SELECT bme.FullName, bme.DisplayName, s.HealthState
FROM state AS s, mt_managedcomputer AS mt, BaseManagedEntity AS bme
WHERE s.basemanagedentityid = bme.basemanagedentityid
AND s.monitorid IN (SELECT MonitorId FROM Monitor WHERE MonitorName =‘System.Health.EntityState’)

– Rules are stored in a table named Rules. This table has columns linking rules to classes and Management Packs.
– To find all rules in a Management Pack use the following query and substitute in the required Management Pack name:
SELECT * FROM Rules WHERE ManagementPackID = (SELECT ManagementPackID FROMManagementPack WHERE MPName = ‘Microsoft.Windows.Server.2003′)

– To find all rules targeted at a given class use the following query and substitute in the required class name:
SELECT * FROM Rules WHERE TargetManagedEntityType = (SELECT ManagedTypeId FROMManagedType WHERE TypeName = ‘Microsoft.Windows.Computer’)

– The Alert table contains all alerts currently open in OpsMgr. This includes resolved alerts until they are groomed out of the database. To get all alerts across all instances of a given monitor use the following query and substitute in the required monitor name:

SELECT * FROM Alert WHERE ProblemID IN (SELECT MonitorId FROM Monitor WHEREMonitorName = ‘Microsoft.SQLServer.2005.DBEngine.ServiceMonitor’)

– To retrieve all alerts for all instances of a specific class use the following query and substitute in the required table name, in this example MT_DBEngine is used to look for SQL alerts:
SELECT * FROM Alert WHERE BaseManagedEntityID IN (SELECT BaseManagedEntityID FROMMT_DBEngine)

– To determine which table is currently being written to for event and performance data use the following query:
SELECT * FROM PartitionTables WHERE IsCurrent = 1

– To retrieve events generated by a specific rule use the following query and substitute in the required rule ID:
SELECT * FROM Event_00 WHERE RuleId = (SELECT RuleId FROM Rules WHERE RuleName =‘Microsoft.Windows.Server.2003.OperatingSystem.CleanShutdown.Collection ‘)

– To retrieve all events generated by rules in a specific Management Pack the following query can be used where the Management Pack name is substituted with the required value:
SELECT * FROM EventAllView
WHERE RuleID IN (SELECT RuleId FROM Rules WHERE ManagementPackId =
(SELECT ManagementPackId FROM ManagementPack WHERE MPName =‘Microsoft.Windows.Server.2003′))

– To retrieve all performance data for a given rule in a readable format use the following query:
SELECT pc.ObjectName, pc.CounterName, ps.PerfmonInstanceName, pd.SampleValue, pd.TimeSampled
FROM PerformanceDataAllView AS pd, PerformanceCounter AS pc, PerformanceSource AS ps
WHERE pd.PerformanceSourceInternalId IN (SELECT PerformanceSourceInternalId FROMPerformanceSource
WHERE RuleId = (SELECT RuleId FROM Rules WHERE RuleName =‘ Microsoft.Windows.Server.2003.LogicalDisk.FreeSpace.Collection’))

– Information on existing User Roles:
SELECT UserRoleName, IsSystem FROM userrole

– Grooming in the DataWarehouse:
– Grooming no longer uses SQL agent jobs.  Grooming is handled by scheduled stored procedures, that run much more frequently, which provides less impact than in the previous version.
– Default grooming for the DW for each dataset, to examine Data Warehouse grooming settings:
SELECT AggregationIntervalDurationMinutes, BuildAggregationStoredProcedureName, GroomStoredProcedureName, MaxDataAgeDays, GroomingIntervalMinutes FROMStandardDatasetAggregation

– The first row is the interval in minutes.
– NULL is raw data, 60 is hourly, and 1440 is daily.
– The second and third row shows what data it is
– MaxDataAgeDays has the retention period in days – this is the field to update if the administrator wants to lower the days of retention.
– RAW alert – 400 days
– RAW event – 100 days
– RAW perf – 10 days (hourly and daily perf = 400 days)
– RAW state – 180 days  (hourly and daily state = 400 days)

– AEM Queries (Data Warehouse):

– Default query to return all RAW AEM data:
SELECT * FROM [CM].[vCMAemRaw] Rw
INNER JOIN dbo.AemComputer Computer ON Computer.AemComputerRowID = Rw.AemComputerRowID
INNER JOIN dbo.AemUser Usr ON Usr.AemUserRowId = Rw.AemUserRowId
INNER JOIN dbo.AemErrorGroup EGrp ON Egrp.ErrorGroupRowId = Rw.ErrorGroupRowId
INNER JOIN dbo.AemApplication App ON App.ApplicationRowId = Egrp.ApplicationRowId

– Count the raw crashes per day:
SELECT CONVERT(char(10), DateTime, 101) AS ”Crash Date (by Day)”, COUNT(*) AS ”Number of Crashes”
FROM [CM].[vCMAemRaw]
GROUP BY CONVERT(char(10), DateTime, 101)
ORDER BY ”Crash Date (by Day)” DESC

– Count the total number of raw crashes in the DW database:
SELECT count(*) FROM CM.vCMAemRaw

– Default grooming for the DW for the AEM dataset:  (Aggregated data kept for 400 days, RAW 30 days by default)
SELECT AggregationTypeID, BuildAggregationStoredProcedureName, GroomStoredProcedureName, MaxDataAgeDays, GroomingIntervalMinutes
FROM StandardDatasetAggregation WHERE BuildAggregationStoredProcedureName =‘AemAggregate’

– MISCELLANEOUS SECTION –
—————————

– Simple query to display large tables, to determine what is taking up space in the database:
SELECT so.name,
8 * Sum(CASE WHEN si.indid IN (0, 1) THEN si.reserved END) AS data_kb,
Coalesce(8 * Sum(CASE WHEN si.indid NOT IN (0, 1, 255) THEN si.reserved END), 0) ASindex_kb,
Coalesce(8 * Sum(CASE WHEN si.indid IN (255) THEN si.reserved END), 0) AS blob_kb
FROM dbo.sysobjects AS so JOIN dbo.sysindexes AS si ON (si.id = so.id)
WHERE ‘U’ = so.type GROUP BY so.name  ORDER BY data_kb DESC

– Is SQL broker enabled?
SELECT is_broker_enabled FROM sys.DATABASES WHERE name = ‘OperationsManager’

– How to identify your version of SQL server:
SELECT  SERVERPROPERTY(‘productversion’), SERVERPROPERTY (‘productlevel’), SERVERPROPERTY (‘edition’)

– SQL 2005:
– SQL Server 2005 RTM                    2005.90.1399
– SQL Server 2005 SP1                     2005.90.2047
– SQL Server 2005 SP1 plus 918222  2005.90.2153
– SQL Server 2005 SP2                     2005.90.3042

number of view: 98
0