Showing posts with label System Center Operations Manager. Show all posts
Showing posts with label System Center Operations Manager. Show all posts

Wednesday, April 19, 2017

Adding license to SCOM

System center licensing guide:

http://download.microsoft.com/download/8/9/A/89A3F8B9-94DE-4956-A56E-F6D2B215D0E6/SystemCenter2012R2_Licensing_Guide.pdf

License check commands:

Get-SCOMManagementGroup | ft skuforlicense, version, timeofexpiration –a

Set-SCOMLicense -ProductId "Enter your license key"



Tuesday, February 14, 2017

How to create a SCOM discovery override using powershell


This is script that can be used to create a scom discovery override using powershell.


## Usage:
## Check the overridable paramters for your discoveries first and then change the parameter you would like to set in $override.Parameter. The format of the parameter may be like
## Selector          : $Config/PeriodInSeconds$. You should only add the "PeriodInSeconds" part
#$disc = Get-SCOMDiscovery -DisplayName "Windows Internet Information Services Web Applications 76-100 Discovery Rule"
## $discovery.GetOverrideableParameters()


Import-module operationsmanager
New-SCOMManagementGroupConnection -ComputerName MyRMS
$mps = Get-SCOMManagementPack |?{$_.name -match "Microsoft.Windows.InternetInformationServices.2003"}
$overridemp = Get-SCOMManagementPack -Name "IIS.Management.Pack.Discovery.Overrides"
$discoveries = Get-SCOMDiscovery -ManagementPack $mps

foreach($discovery in $discoveries)
{
if($discovery.Enabled -ne "false")
{

$override = $null
$overridemp = Get-SCOMManagementPack -Name "IIS.Management.Pack.Discovery.Overrides"
$Target= Get-SCOMClass -id $discovery.Target.Id

$overridename = $discovery.name + ".Override"
$override = New-Object Microsoft.EnterpriseManagement.Configuration.ManagementPackDiscoveryConfigurationOverride($overridemp,$overridename)
$override.Discovery = $discovery
$override.Module = $discovery.DataSource
$override.Parameter = "PeriodInSeconds"
$override.value = 86400
$override.DisplayName = $overridename
$override.Context = $Target

}
}

$overridemp.Verify() ## This may fail sometimes with a validation error on 2012 R2. So just remove this line and check if your mp imports.
$overridemp.AcceptChanges()

Tuesday, January 17, 2017

Users cannot view ACS reports.

For the ACS reports the permissions have to be configured in SCOM.

Click Administration--User Roles

If you do not have a role created. Create a new role called "ACS report viewers"

In the tab that opens add the groups in your AD or users in your AD that you would like to have permissions to view reports.

Tuesday, December 20, 2016

Scom Maintenance mode scheduler

#SCOM Maintenance mode scheduler. The assemblies can be found in this folder on your management servers  C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\SDK Binaries

$scriptdir = Get-location
$ScriptDir = split-path -parent $MyInvocation.MyCommand.Path
$void = [System.Reflection.Assembly]::LoadFile("$scriptdir\Microsoft.EnterpriseManagement.OperationsManager.dll")
$void3 = [System.Reflection.Assembly]::LoadFile("$scriptdir\Microsoft.EnterpriseManagement.Runtime.dll")
$void1 = [System.Reflection.Assembly]::LoadFile("$scriptdir\Microsoft.EnterpriseManagement.Core.dll")

$server = "testsql"

$RootMS = "testdc01"
$Minutes =  60
$Comment = "Scheduled Maintenance Request"
$MGConnSetting = New-Object Microsoft.EnterpriseManagement.ManagementGroupConnectionSettings($RootMS)
$MG = New-Object Microsoft.EnterpriseManagement.ManagementGroup($MGConnSetting)
$Admin = $MG.GetAdministration()
$Agents = $admin.GetAllAgentManagedComputers()
$agent = $Agents | ?{$_.Computername -match $server}
$monitoring =$MG.Monitoring
$AllClasses = $MG.GetMonitoringClasses()
$MyClass = $AllClasses | ?{$_.name -eq "Microsoft.Windows.Computer"}
$Objects = $Mg.GetMonitoringObjects($Myclass)
$Object = $Objects | ?{$_.name -match $server}
$Object.schedulemaintenancemode
$startTime = [Datetime]'12/21/2016 04:26:00'
$StartTimeUTC = $startTime.ToUniversalTime()
$EndTime = $startTimeUTC.AddMinutes('10')
$Object.ScheduleMaintenanceMode($startTimeUTC,$EndTime,"PlannedOther",$Comment)

 

Friday, December 9, 2016

SCOM agent less monitoring access denied

Today I was facing and error with monitoring agentless servers. The agent proxy was getting access denied to event logs. In my environment the health services run under the local system account.

I added the server account to administrators on the agentless server but it did not help.

Then I made changes in the default action account profile for the server and and specified another action account instead of the local system action account to run the healthservices under.

Then everything was peachy...

Task to restart health service on agents

https://blogs.technet.microsoft.com/scom_atlas/2015/05/21/task-to-restart-scom-health-service/

Once the management pack is added go to Monitoring-.Windows Computer.

You should see the task in the Tasks pane under Windows Computer Tasks.

 

 

Tuesday, December 6, 2016

SCOM DataWare House grooming.

Query to check the size of the tables.

SELECT DB_NAME() AS DbName,
name AS FileName,
size/128.0 AS CurrentSizeMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB
FROM sys.database_files;

Get size of the database.
SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
GO

Query to check DW data dates.

Select     min(datetime)as MinDate, max(datetime)as MaxDate ,   datediff(d,min(datetime),max(datetime)) AS NoOfDaysInDataSet from Perf.vPerfHourly

My query showed that there was 424 days of data.

MinDate    MaxDate    NoOfDaysInDataSet
2015-10-09 21:00:00.000    2016-12-06 13:00:00.000    424

Tool for modifying the datawarehouse grooming settings can be downloaded here.

https://blogs.technet.microsoft.com/momteam/2008/05/13/data-warehouse-data-retention-policy-dwdatarp-exe/

Command to run the dwdatarp.exe to get the current sizes of datasets.

C:\temp>dwdatarp.exe -s servername\instancename -d operationsmanagerdw > c:\temp\dwoutput.txt

Dataset name                          Aggregation name     Max Age         Current Size, Kb

Alert data set                             Raw data                           400          104,752 (  0%)
Client Monitoring data set     Raw data                           30              0 (  0%)
Client Monitoring data set     Daily aggregations          400            96 (  0%)
Configuration dataset             Raw data                           400            485,120 (  1%)
DPM event dataset                  Raw data                           400             0 (  0%)
Event data set                           Raw data                           100             12,315,568 ( 14%)
Performance data set              Raw data                           10                4,316,832 (  5%)
Performance data set              Hourly aggregations       400            44,009,336 ( 50%)
Performance data set              Daily aggregations          400            2,049,856 (  2%)
State data set                            Raw data                           180            121,784 (  0%)
State data set                            Hourly aggregations       400           22,979,912 ( 26%)
State data set                            Daily aggregations          400           1,395,216 (  2%)

Changing the grooming settings. Adjust the time according to my reporting requirements.

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "Alert data set" -a "Raw data" -m 180

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "Performance data set" -a "Hourly aggregations" -m 90

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "Performance data set" -a "Daily aggregations" -m 365

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "Event data set" -a "Raw Data" -m 30

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "State data set" -a "Raw data" -m 90

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "State data set" -a "Hourly aggregations" -m 90

dwdatarp.exe -s SERVERNAME\INSTANCENAME -d OperationsManagerDW -ds "State data set" -a "Daily aggregations" -m 90

Wednesday, October 5, 2016

Put Scom Agents and Cluster Servers in Maintenance mode and reboot

Here is a script to put your scom agents including clusters in maintenance mode and rebooting them at a specified time. First you will have to create a task and a management pack in SCOM for rebooting the servers. Link on how to create the management pack is here. https://technet.microsoft.com/en-us/library/hh563486%28v=sc.12%29.aspx?f=255&MSPPError=-2147217396.
Works on System Center Operations Manager 2012 R2.

Create the input files and output files on the locations that you prefer. I have created them in C:\Reboots folder. Add your server names in the input file. Then the script given below can be put in a scheduled task and run at specified times or on demand. You can also run the script manually. Make sure that you modify the maintenance window.

I have not yet added any code to verify and alert if the rebooted servers are not back up.

Will probably do so at a later time. Till then feel free to use this one and modify any way that you like.

#################Script Start ####################################

$RootMS = "RMSName"
$Minutes =  90
$Comment = "Unknown"
#Setting up SCOM connection

Import-Module OperationsManager
$null = New-ScomManagementGroupConnection -ComputerName $RootMS
Add-PSSnapin "Microsoft.EnterpriseManagement.OperationsManager.Client" -ErrorAction SilentlyContinue

$eventLog = New-Object System.Diagnostics.EventLog("Operations Manager")
$eventLog.Source = "Maintenance Mode"

$Servers = GC "C:\Reboots\input.txt"
Function Out($output)
{
Out-File -Filepath "C:\Reboots\output.txt" -InputObject $output -Append
}

Out "###############  Starting Script at $(Get-Date)  ##########################"
foreach($Server in $Servers)
{

$output = "Starting for $Server on $(Get-date)"
Out $output

###Putting the agent and cluster in maintenance mode###########
$agent = Get-ScomAgent | Where-Object { $_.DisplayName –eq $Server -or $_.ComputerName -eq $Server -or $_.PrincipalName -eq $Server }
if(!$agent) { Write-Host "ERROR: $Server is not a monitored system in SCOM." -ForeGroundColor Red; Set-Location $originalPath; return }
$Server = $agent.PrincipalName
$startTime = (Get-Date).ToUniversalTime()
$endTime = $startTime.AddMinutes($Minutes)
if(($clusters = $agent.GetRemotelyManagedComputers())) {
$clusterNodeClass = Get-SCOMClass -Name Microsoft.Windows.Cluster.Node
foreach($cluster in $clusters) {
#$clusterObj = Get-SCOMClass -Name Microsoft.Windows.Cluster | Get-ScomMonitoringObject -Criteria "Name='$($cluster.ComputerName)'"
$clusterobj = Get-SCOMClass -Name Microsoft.Windows.Cluster | Get-SCOMClassInstance | ?{$_.displayname -eq $cluster.ComputerName}
if($clusterObj) {
$clusterObj.ScheduleMaintenanceMode($startTime,$endTime,"PlannedOther",$Comment,"Recursive")
$nodes = $clusterObj.GetRelatedMonitoringObjects($clusterNodeClass)
if($nodes) {
foreach($node in $nodes) {
Out "Putting $node into maintenance mode."
$eventLog.MachineName = $node.Name
$eventLog.WriteEntry("The server entered into maintenance mode $(if($Server -notcontains $node.Name){"on behalf of $Server"}).`r`n`r`nDuration:`t$Minutes minutes`r`nReason:`t$Comment","Information",42)
}
}
}
Out "Putting $($cluster.Computer) into maintenance mode."
New-MaintenanceWindow -StartTime $startTime -EndTime $endTime -MonitoringObject $cluster.Computer -Reason PlannedOther -Comment $Comment
}
}
else {
Out "Putting $Server into maintenance mode."
$eventLog.WriteEntry("The server entered into maintenance mode.`r`n`r`nDuration:`t$Minutes minutes`r`nReason:`t$Comment","Information",42)
New-MaintenanceWindow -StartTime $startTime -EndTime $endTime -MonitoringObject $agent.HostComputer -Reason PlannedOther -Comment $Comment
}
#####Sending commands to the server###########

$Task = Get-SCOMTask -DisplayName "Reboot Computer"
$Overrides = @{Arguments = '"$Target/Property[Type="MicrosoftWindowsLibrary7585010!Microsoft.Windows.Computer"]/PrincipalName$" "true"'}
$Instance = Get-SCOMClassInstance | ?{$_.Name -eq $agent.name}
Out "Starting task to reboot $($Instance.Displayname) at $(Get-Date)"
Start-SCOMTask -Task $Task -Override $Overrides -Instance $Instance

}

Out "###############  Script Complete at $(Get-Date) #########################"

#################Script End ####################################


I don't take credit for all the scripts that I written. Whenever I can credit the original creators, I do.  If I don't at times please do inform me so that I can include them in the page.

Monday, January 5, 2015

Export all rules and monitors with thresholds

Exporting all rules and monitors with thresholds in your SCOM environment.

I found these on the following link

http://technet.microsoft.com/en-us/library/ff723847.aspx


[code language="css"]
##Export all rules

function GetPerfCounterName ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
return ($config.Config.ObjectName + "\" + $config.Config.CounterName)
}

function GetFrequency ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$frequency = $config.Config.Frequency;

if($frequency -eq $null)
{
$frequency = $config.Config.IntervalSeconds;
}

return ($frequency)
}

function GetDisplayName($performanceRule)
{
if($performanceRule.DisplayName -eq $null)
{
return ($performanceRule.Name);
}
else
{
return ($performanceRule.DisplayName);
}
}

function GetWriteActionNames($performanceRule)
{
$writeActions = "";
foreach($writeAction in $performanceRule.WriteActionCollection)
{
$writeActions += " " + $writeAction.Name;
}
return ($writeActions);
}

$perf_collection_rules = get-SCOMRule # -criteria:"Category='PerformanceCollection'"

$perf_collection_rules | select-object @{name="Type";expression={foreach-object {(Get-MonitoringClass -id:$_.Target.Id).DisplayName}}},@{name="RuleDisplayName";expression={foreach-object {GetDisplayName $_}}} ,@{name="CounterName";expression={foreach-object {GetPerfCounterName $_.DataSourceCollection[0].Configuration}}},@{name="Frequency";expression={foreach-object {GetFrequency $_.DataSourceCollection[0].Configuration}}},@{name="WriteActions";expression={foreach-object {GetWriteActionNames $_}}}  | sort Type,RuleDisplayName,CounterName | export-csv  "C:\Outputs\CollectionRules.csv"

[/code]



[code language="css"]

## Export all monitors

function GetThreshold ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$threshold = $config.Config.Threshold
if($threshold -eq $null)
{
$threshold = $config.Config.MemoryThreshold
}
if($threshold -eq $null)
{
$threshold = $config.Config.CPUPercentageThreshold
}
if($threshold -eq $null)
{
if($config.Config.Threshold1 -ne $null -and $config.Config.Threshold2 -ne $null)
{
$threshold = "first threshold is: " + $config.Config.Threshold1 + " second threshold is: " + $config.Config.Threshold2
}
}
if($threshold -eq $null)
{
if($config.Config.ThresholdWarnSec -ne $null -and $config.Config.ThresholdErrorSec -ne $null)
{
$threshold = "warning threshold is: " + $config.Config.ThresholdWarnSec + " error threshold is: " + $config.Config.ThresholdErrorSec
}
}

if($threshold -eq $null)
{
if($config.Config.LearningAndBaseliningSettings -ne $null)
{
$threshold = "no threshold (baseline monitor)"
}
}
return $threshold
}
Function GetFrequency ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$Frequency = $config.Config.Frequency
if($Frequency -eq $null)
{
$frequency = $config.Config.Frequency;
}
return ($frequency)
}
Function GetNumsamples ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$Samples = $config.Config.Samples
if($Samples -eq $null)
{
$Samples = $config.Config.NumSamples;
}
return ($Samples)
}
Function GetCounterName ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$Counter = $config.Config.Counter
if($Counter -eq $null)
{
$Counter = $config.Config.CounterName;
}
return ($Counter)
}
Function GetObject ([String] $configuration)
{
$config = [xml] ("<config>" + $configuration + "</config>")
$Object = $config.Config.Object
if($Object -eq $null)
{
$Object = $config.Config.ObjectName;
}
return ($Object)
}
$perfMonitors = get-scommonitor
$perfMonitors | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}},@{name="Target";expression={foreach-object {(Get-SCOMClass -Id:$_.Target.Id).DisplayName}}},DisplayName,enabled,@{name="Threshold";expression={foreach-object {GetThreshold $_.Configuration}}}, @{name="Frequency";expression={foreach-object {GetFrequency $_.Configuration}}}, @{name="Samples";expression={foreach-object {GetNumSamples $_.Configuration}}}, @{name="Counter";expression={foreach-object {GetCounterName $_.Configuration}}}, @{name="Object";expression={foreach-object {GetObject $_.Configuration}}} | sort Target, DisplayName | export-csv "C:\Outputs\PerformanceMonitors.csv"

[/code]

Monday, April 21, 2014

Android and windows,hotmail contacts not syncing.

I recently had to get a new phone because my trusty old Nokia WP stopped charging altogether. I broke the USB port on the phone.

They really should be having a backup port on the phones. It takes a whopping amount to repair once they are out of warranty.

Anyways, I got this new Android phone and added my Hotmail account. The contacts synced perfectly the first time. But then I had to factory reset it once and when I added the account I could not see any contact syncing. Not matter how many times I reconfigured my account on the phone. The contacts just did not sync. I stumbled on this post which talks about making changes to my windows live account.

http://answers.microsoft.com/en-us/outlook_com/forum/oemail-oapps/outlookcom-not-syncing-all-my-contacts-to-my/5a30f3dc-1bfb-475a-a67c-b282d1cd9c89

But sadly I did not have the time for someone to make changes to my account. So, I made a backup of my account contacts by logging to the account from a computer. Then deleted all the contacts from my windows live account. Waited a couple of minutes, signed out.

and signed back in. Not really sure if that was required, though. Imported all the contacts from file after cleaning up the duplicates using MSExcel's "Remove duplicates button" and without reconfiguring my account on the phone all the contacts started syncing.

Tuesday, February 11, 2014

Pool Manager Issues

When an OpsMgr 2012 architecture is « big » and when we have Pool manager issues, the following keys should be created on all MS HKLM\System\CurrentControlSet\Services\HealthService\Parameters\PoolManager PoolLeaseRequestPeriodSeconds DWORD 600 PoolNetworkLatencySeconds DWORD 120

Taken from below link.

http://support.microsoft.com/kb/2714482

Wednesday, September 18, 2013

Manually run partitioning and grooming on SCOM database

The following query if run on the SCOM db will run the grooming on all the partition tables. There are 122 partition tables in SCOM 2012. This will run for each one of them as their Iscurrent value is set to 1.

/*-------------------------------*/

declare @counter int  set @counter = 0  while @counter < 122

begin

exec p_PartitioningAndGrooming

set @counter = @counter + 1

print 'The counter is ' + cast(@counter as char)

end

/*-----------------------------*/

Friday, August 23, 2013

Change authentication account in NTLM Webapplication

#Usage:.Change-NTLMAccount -rms "rms.contoso.com" -currentaccount 'curracct' -newAccount 'newacct'

param([string] $rms,$currentAccount,$newAccount)

function DisplayUpdate ($str, $color = "white") {
$now = [DateTime]::Now

Write-Host "[$now]" -ForegroundColor white -NoNewline
Write-Host " $str`r" -ForegroundColor $color
}

$scriptPath = split-path -parent $MyInvocation.MyCommand.Path
$managementGroupRmsName = $rms
$newActionAccountName = $newAccount
#Load Dll's
Displayupdate "Loading SDK dll's"
$void1 = [System.Reflection.Assembly]::LoadFrom("$scriptPathMicrosoft.EnterpriseManagement.Core.dll")
if(!$void1) {Displayupdate "DLL's not found..exiting..." "red";break;}
$void2 = [System.Reflection.Assembly]::LoadFrom("$scriptPathMicrosoft.EnterpriseManagement.OperationsManager.dll")
if(!$void2) {Displayupdate "DLL's not found..exiting..." "red";break;}
$void3 = [System.Reflection.Assembly]::LoadFrom("$scriptPathMicrosoft.EnterpriseManagement.Runtime.dll")
if(!$void3) {Displayupdate "DLL's not found..exiting..." "red";break;}
$mg = New-Object Microsoft.EnterpriseManagement.ManagementGroup($managementGroupRmsName)
Displayupdate "connected to MG:$Mg.name"
Displayupdate "Getting mps.."
$mps = $mg.getmanagementpacks() | where{$_.name -match "NTLM"}
if($mps.count -gt 0 ) {
$count = $mps.count
Displayupdate "[$count] number of mp's found" "yellow"
$healthServices = dir -R | where {$_.UniquePathName -like "Microsoft.SystemCenter.HealthService*"}
$Srs = $mg.getmonitoringSecurereferences() | where{$_.name -match "WebApplication"}
$healthServices = dir -R | where {$_.UniquePathName -like "Microsoft.SystemCenter.HealthService*"}
$newActionAccount = $mg.GetMonitoringSecureData() | where {$_.UserName -eq $newActionAccountName -and $_.Type -eq "Windows" -and $_.name -notmatch "Data Warehouse Report Deployment Account"}

foreach($sr in $Srs)
{
$secureDataHSRefs = $mg.GetMonitoringSecureDataHealthServiceReferenceBySecureReferenceId($sr.Id)
foreach($secureDataHSRef in $secureDataHSRefs){
$healthService = $mg.GetMonitoringObject($secureDataHSRef.HealthServiceId)
$currentActionAccount = $mg.GetMonitoringSecureData($secureDataHSRef.MonitoringSecureDataId)
DisplayUpdate "Changing Action Account on $($sr.GetManagementpack().Displayname)" "yellow"
$secureDataHSRef.MonitoringSecureDataId = $newActionAccount.Id
$secureDataHSRef.Update()
}
}
}

else
{
Displayupdate "No NTLM mp's found..exiting.." "red"
break;
}

DisplayUpdate "Script finished"

Tuesday, August 20, 2013

My frequently used SCOM Queries

I won't take the credit for most of these queries. I have compiled them overtime from different blogs, sites

/* Database size */

SELECT DB_NAME() AS DbName,
name AS FileName,
size/128.0 AS CurrentSizeMB,
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS INT)/128.0 AS FreeSpaceMB
FROM sys.database_files;.

/*PERFORMANCE related queries*/

select top 20 pcv.ObjectName, pcv.CounterName, count (pcv.countername) as Total from performancedataallview as pdv, performancecounterview as pcv where (pdv.performancesourceinternalid = pcv.performancesourceinternalid) group by pcv.objectname, pcv.countername order by count (pcv.countername) desc

select top 2000 Path,ObjectName, count(ObjectName) from PerformanceDataAllView pdv with (NOLOCK) inner join PerformanceCounterView pcv with (NOLOCK) on pdv.performancesourceinternalid = pcv.performancesourceinternalid inner join BaseManagedEntity bme with (NOLOCK) on pcv.ManagedEntityId = bme.BaseManagedEntityId where  pcv.ObjectName like 'Processor' group by Path,ObjectName order by count(ObjectName) desc

 

/* Top Noisy Rules in the last 24 hours */

select ManagedEntityTypeSystemName, DiscoverySystemName, count(*) As 'Changes' from (select distinct MP.ManagementPackSystemName, MET.ManagedEntityTypeSystemName, PropertySystemName, D.DiscoverySystemName, D.DiscoveryDefaultName, MET1.ManagedEntityTypeSystemName As 'TargetTypeSystemName', MET1.ManagedEntityTypeDefaultName 'TargetTypeDefaultName', ME.Path, ME.Name, C.OldValue, C.NewValue, C.ChangeDateTime from dbo.vManagedEntityPropertyChange C inner join dbo.vManagedEntity ME on ME.ManagedEntityRowId=C.ManagedEntityRowId inner join dbo.vManagedEntityTypeProperty METP on METP.PropertyGuid=C.PropertyGuid inner join dbo.vManagedEntityType MET on MET.ManagedEntityTypeRowId=ME.ManagedEntityTypeRowId inner join dbo.vManagementPack MP on MP.ManagementPackRowId=MET.ManagementPackRowId inner join dbo.vManagementPackVersion MPV on MPV.ManagementPackRowId=MP.ManagementPackRowId left join dbo.vDiscoveryManagementPackVersion DMP on DMP.ManagementPackVersionRowId=MPV.ManagementPackVersionRowId AND CAST(DefinitionXml.query('data(/Discovery/DiscoveryTypes/DiscoveryClass/@TypeID)') AS nvarchar(max)) like

'%'+MET.ManagedEntityTypeSystemName+'%' left join dbo.vManagedEntityType MET1 on MET1.ManagedEntityTypeRowId=DMP.TargetManagedEntityTypeRowId left join dbo.vDiscovery D on D.DiscoveryRowId=DMP.DiscoveryRowId where ChangeDateTime > dateadd(hh,-24,getutcdate()) ) As #T group by ManagedEntityTypeSystemName, DiscoverySystemName order by count(*) DESC

and

/* Modified properties in the last 24 hours */

select distinct MP.ManagementPackSystemName, MET.ManagedEntityTypeSystemName, PropertySystemName, D.DiscoverySystemName, D.DiscoveryDefaultName, MET1.ManagedEntityTypeSystemName As 'TargetTypeSystemName', MET1.ManagedEntityTypeDefaultName 'TargetTypeDefaultName', ME.Path, ME.Name, C.OldValue, C.NewValue, C.ChangeDateTime from dbo.vManagedEntityPropertyChange C inner join dbo.vManagedEntity ME on ME.ManagedEntityRowId=C.ManagedEntityRowId inner join dbo.vManagedEntityTypeProperty METP on METP.PropertyGuid=C.PropertyGuid inner join dbo.vManagedEntityType MET on MET.ManagedEntityTypeRowId=ME.ManagedEntityTypeRowId inner join dbo.vManagementPack MP on MP.ManagementPackRowId=MET.ManagementPackRowId inner join dbo.vManagementPackVersion MPV on MPV.ManagementPackRowId=MP.ManagementPackRowId left join dbo.vDiscoveryManagementPackVersion DMP on DMP.ManagementPackVersionRowId=MPV.ManagementPackVersionRowId     AND CAST(DefinitionXml.query('data(/Discovery/DiscoveryTypes/DiscoveryClass/@TypeID)') AS nvarchar(max)) like

'%'+MET.ManagedEntityTypeSystemName+'%' left join dbo.vManagedEntityType MET1 on MET1.ManagedEntityTypeRowId=DMP.TargetManagedEntityTypeRowId left join dbo.vDiscovery D on D.DiscoveryRowId=DMP.DiscoveryRowId where ChangeDateTime > dateadd(hh,-24,getutcdate()) ORDER BY MP.ManagementPackSystemName, MET.ManagedEntityTypeSystemName

/*Discovery frequencies in the management packs*/

select       ds.DiscoveryName,       mp.MpName,       CAST(md.ModuleConfiguration as XML).value('/Frequency[1]','int') as 'Frequency' from Module (nolock) as md inner join Discovery (nolock) as ds       on md.ParentId = ds.DiscoveryId inner join ManagedType (nolock) as mt       on mt.ManagedTypeId = ds.DiscoveryTarget inner join ManagementPack (nolock) as mp       on mp.ManagementPackId = ds.ManagementPackId

Monday, August 19, 2013

Who is connected to my SCOM console

The following command will help to find who is connected to your SCOM console. This works for SCOM 2012.

(Get-SCOMManagementGroup).getconnectedusernames()

For SCOM 2007 you will have to use the ones below. I have not tested the below commands, though.

Get-ManagementGroupConnection | foreach-object {$_.ManagementGroup.getConnectedUserNames()}
Get-ManagementGroupConnection | foreach-object {$_.ManagementGroup.getConnectedUserNames()} | measure-object

 

Friday, July 19, 2013

Adding or removing a new SCOM zone from Om12 agent

Using Powershell:

Remove Management group

$OMCfg = New-Object -ComObject AgentConfigManager.MgmtSvcCfg;

$OMCfg.RemoveManagementGroup("zonetoberemoved")

 

Add management group

$OMCfg = New-Object -ComObject AgentConfigManager.MgmtSvcCfg;

$OmCfg.AddmanagementGroup(‘zonenametobeadded’,'MSNamewithFQCN',5723)

Sunday, September 23, 2012

SCOM 2007 authoring console crash

When i was checking the rules on my console.I had set the scope to all objects and since then it kept on crashing on me. It would load the other views but never the authoring console.Followed this link http://blog.tyang.org/2010/07/06/scom-console-crashes/

And this gave me a fair idea of what could be happening.My scom zone had many management packs loaded. By many i mean many, more that 500.So I just checked this reg key on another zone and the classes that were scoped in that. This console had only the root management server scoped. I copied the reg key from this RMS and imported on the problematic one. Woo hoo!! My console was not crashing anymore and it opened at the RMS scope here too. Here is the reg key.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Microsoft Operations Manager\3.0\Console\Navigation\MonitoringConfigNavSettings] "SelectedViewNodeId"="91aaa624-bebf-21db-858c-76d50a6a8d99" "ScopedClasses"="1a9387f0-6fe5-5527-a2cb-73f2f6be6bc7" "AuthoringSpaceViewedFirstTime"=dword:00000000 "UseDefaultScoping"=dword:00000000