First some background info on my network at home.
So I looked for a software router which could be installed as a guest on my Hyper-V host. I started with BrazilFW, but I had trouble to get the Gateway and DNS running (failed) although a colleague was able to get BrazilFW running on Hyper-V by upgrading the SYSLINUX (bootloader for Linux). Then I tried Freesco and m0n0wall, but both would not start on Hyper-V. So I finally found Vyatta via SourceForge.
Vyatta is a Linux-based, open network operating system that integrates advanced enterprise-class routing, security, bandwidth management and more. Vyatta runs on standard x86 hardware, VMWare & Xen and offers config via Linux-shell, CLI and web GUI.
It runs on VMWare & Xen so why would not it run on Hyper-V? And I was correct it runs great on Hyper-V ;-) These are steps I’ve taken to get it running on Hyper-V.
vyatta@vyatta> configure [edit] vyatta@vyatta# set interfaces ethernet eth0 address 192.168.1.254/24 [edit] vyatta@vyatta# commit [edit] vyatta@vyatta# exit exit vyatta@vyatta>
vyatta@vyatta> configure [edit] vyatta@vyatta# set interfaces ethernet eth1 address 192.168.2.254/24 [edit] vyatta@vyatta# commit [edit] vyatta@vyatta# exit exit vyatta@vyatta>
vyatta@vyatta> configure [edit] vyatta@vyatta# set interfaces ethernet eth2 address 192.168.3.254/24 [edit] vyatta@vyatta# commit [edit] vyatta@vyatta# exit exit vyatta@vyatta>
vyatta@vyatta:~$ configure [edit] vyatta@vyatta# show interfaces ethernet eth0 { address 192.168.1.254/24 description Internet hw-id 00:15:5d:00:01:22 } eth1 { address 192.168.2.254/24 description "subnet1:MOM 2005" hw-id 00:15:5d:00:01:23 } eth2 { address 192.168.3.254/24 description "subnet2:OPSMGR 2007" }
vyatta@vyatta# save Saving configuration to '/opt/vyatta/etc/config/config.boot'... Done [edit]
vyatta@vyatta# set system name-server 192.168.1.1 [edit] vyatta@vyatta# commit [edit] vyatta@vyatta#
vyatta@vyatta# set system gateway-address 192.168.1.1 [edit] vyatta@vyatta# commit [edit] vyatta@vyatta#
vyatta@vyatta# set firewall name block-subnet1 [edit] vyatta@vyatta# set firewall name block-subnet1 rule 1 [edit] vyatta@vyatta# set firewall name block-subnet1 rule 1 source address 192.168.2.0/24 [edit] vyatta@vyatta# set firewall name block-subnet1 rule 1 action drop [edit] vyatta@vyatta# set firewall name block-subnet1 rule 2 [edit] vyatta@vyatta# set firewall name block-subnet1 rule 2 action accept vyatta@vyatta# commit [edit] vyatta@vyatta#
vyatta@vyatta# set firewall name block-subnet2 [edit] vyatta@vyatta# set firewall name block-subnet2 rule 1 [edit] vyatta@vyatta# set firewall name block-subnet2 rule 1 source address 192.168.3.0/24 [edit] vyatta@vyatta# set firewall name block-subnet2 rule 1 action drop [edit] vyatta@vyatta# set firewall name block-subnet2 rule 2 [edit] vyatta@vyatta# set firewall name block-subnet2 rule 2 action accept vyatta@vyatta# commit [edit] vyatta@vyatta#
vyatta@vyatta# set interfaces ethernet eth1 firewall out name block-subnet2 [edit] vyatta@vyatta# set interfaces ethernet eth2 firewall out name block-subnet1 [edit] vyatta@vyatta# commit [edit] vyatta@vyatta#
Final configuration:
vyatta@vyatta:~$ show configuration firewall { name block-subnet1 { rule 1 { action drop source { address 192.168.2.0/24 } } rule 2 { action accept } } name block-subnet2 { rule 1 { action drop source { address 192.168.3.0/24 } } rule 2 { action accept } } name block-subnet3 { rule 1 { action drop source { address 192.168.2.0/24 } } rule 2 { action accept } rule 3 { action drop source { address 192.168.3.0/24 } } } } interfaces { ethernet eth0 { address 192.168.1.254/24 description Internet hw-id 00:15:5d:00:01:22 } ethernet eth1 { address 192.168.2.254/24 description "subnet1:MOM 2005" firewall { out { name block-subnet2 } } hw-id 00:15:5d:00:01:23 } ethernet eth2 { address 192.168.3.254/24 description "subnet2:OPSMGR 2007" firewall { out { name block-subnet1 } } hw-id 00:15:5d:00:01:24 } loopback lo { } } service { nat { rule 1 { outbound-interface eth0 source { address 192.168.2.0/24 } type masquerade } rule 2 { outbound-interface eth0 source { address 192.168.3.0/24 } type masquerade } } ssh { } } system { gateway-address 192.168.1.1 login { user root { authentication { encrypted-password **************** } } user vyatta { authentication { encrypted-password **************** } } } name-server 192.168.1.1 ntp-server 69.59.150.135 package { repository community { components main distribution stable url http://packages.vyatta.com/vyatta } } } vyatta@vyatta:~$
Don’t forget to save your configuration!
Now you are done! Check out the documentation for Vyatta before starting. I used the QuickStart and the Command Reference.
Some time ago I showed you can use PowerShell to create Events for OpsMgr 2007. And according to the comments quite some people have questions about Event parameters. After creating the first version of the PowerShell Create Events for OpsMgr 2007 script, Ken added some functionality and one was modifying the question to not only add a EventLog Description but also a EventLog Parameter.
I found some info on MOM 2005 parameters on Rory McCaw’s weblog, but except that article I could not find much info on Event Log parameters. So hopefully this will explain what parameters are and how they can be used in OpsMgr 2007.
Every Windows event has description text that is filled in by the values of different parameters. You can find the Eventlog parameters of an event by using the Log Parser. (if you know an easier way on Windows 2003 Servers let me know). Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.
Example of EventLog Parameters in an Eventlog:
C:\Program Files\Log Parser 2.2>LogParser.exe "SELECT Top1 Strings AS Parameters FROM Application WHERE EventID=301"
Result:
So in this example you can use four parameters in your OpsMgr Rules or Monitor.
Eventlog Parameters can be used in OpsMgr Rules and Monitors. An example where you can find EventLog Parameters used is the Windows Activation State Monitor in the Windows Server 2003 MP. This is a 3 State Event Log Monitor and this monitor looks for EventLog Parameters and the values found in the Eventlog change the state of the monitor.
Healthy: Look for EventId 1006 in Application Log of Source Windows Product Activation Warning: Look for EventId 1005 in Application Log of Source Windows Product Activation and Params/Param[1] > 6 =< 15 Critical: Look for EventId 1005 in Application Log of Source Windows Product Activation and Params/Param[1] =< 6
You can use the PowerShell Create Events script from Ken to test your monitors or rules with with one EventLog parameter. So it won’t work if you need to test a Rule or Monitor which uses more than one parameter in the Eventlog.
So if you want to test the Windows Activation State Monitor and want to Change the State to Critical, you need to create an Event with the next values:
More info about this event can be found on EventID.Net
Last week I was helping a customer with some OpsMgr certificate issues with their monitoring Agents in a non-trusted domain. More info on Monitoring an Agent in a non-trusted domain can be found here: http://blogs.technet.com/smsandmom/archive/2008/09/10/opsmgr-2007-monitoring-an-agent-in-a-non-trusted-domain.aspx
These were the events in the OperationsManager Eventlog:
Event Type: Warning Event Source: OpsMgr Connector Event Category: None Event ID: 20067 Date: 6/17/2009 Time: 3:33:31 PM User: N/A Computer: computername Description: A device at IP 192.168.1.1:5723 attempted to connect but the certificate presented by the device was invalid. The connection from the device has been rejected. The failure code on the certificate was 0x800B010A (A certificate chain could not be built to a trusted root authority.).
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Event Type: Warning Event Source: OpsMgr Connector Event Category: None Event ID: 21002 Date: 6/17/2009 Time: 3:33:31 PM User: N/A Computer: computername Description: The OpsMgr Connector could not accept a connection from 192.168.1.1:5723 because mutual authentication failed.
Event Type: Error Event Source: OpsMgr Connector Event Category: None Event ID: 20070 Date: 6/17/2009 Time: 3:33:31 PM User: N/A Computer: computername Description: The OpsMgr Connector connected to MS01.support.local, but the connection was closed immediately after authentication occurred. The most likely cause of this error is that the agent is not authorized to communicate with the server, or the server has not received configuration. Check the event log on the server for the presence of 20000 events, indicating that agents which are not approved are attempting to connect.
Event Type: Error Event Source: OpsMgr Connector Event Category: None Event ID: 21016 Date: 6/17/2009 Time: 3:33:33 PM User: N/A Computer: computername Description: OpsMgr was unable to set up a communications channel to MS01.support.local and there are no failover hosts. Communication will resume when MS01.support.local is available and communication from this computer is allowed.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp
So it was clear the agent could not communicate with the Management Server in the un-trusted domain using certificates. So we needed to check if the certificates were ok. And in this case it turned out that Certutil was our friend ;-). Certutil.exe is a command-line program that is installed as part of Certificate Services in the Windows Server 2003 family (and higher). Here are the steps we took to verify that there was certificate issue and how we solved it.
Issue: Agent needing a certificate to communicate with Management Server are generating “A certificate chain could not be built to a trusted root authority” event ids (20067, 20070, 21016) errors in the Operations Manager eventlog.
Reason: Wrong proxy settings, so the (Intermediate) Root CA could not be contacted.
See next line in output from certutil -urlfetch -verify <cert.cer> tool:
Failed "AIA" Time: 0 Error retrieving URL: The server name or address could not be resolved 0x80072ee7 (WIN32: 12007) http://cert.domain.local/aia/SUPPORT.WEB%20ROOT%20CA.crt
Complete output from certutil see attachment certutil_output.txt
Steps to solve issue:
While the rest of the System Center community is in Vegas for MMS2012 I’m helping customers with their questions about System Center Operations Manager 2012. To be honest I’m little jealous on all the people who are in Vegas right now.
So I created some more detailed documentation on how to start monitoring your non-domain members (workgroup servers in your DMZ) in OM2012.
It are still the same steps as in OM 2007 so if you already familiar with those steps it would be easy for you.
I created a simple Diagram to have a high-level overview on which steps are being executed on which machines.
Environment:
Some important notes:
Guide info: http://technet.microsoft.com/en-us/library/dd362655.aspx
Pre-reqs:
It is assumed that you have AD CS installed, an HTTPS binding is being used, and its associated certificate has been installed. Information about creating an HTTPS binding is available in the topic How to Configure an HTTPS Binding for a Windows Server 2008 CA.
High-Level steps:
Step 1. Download the Trusted Root (CA) certificate
[OM12MS02.demo.stranger]
Download a CA Certificate, certificate chain, or CRL
Step 2. Import the Trusted Root (CA) Certificate
Open Certificates Local Computer account MMC:
Import Certificate TrustedCA.p7b
Step 3. Create a setup information file to use with the CertReq command-line utility.
Step 4. Create a request file to use with a stand-alone CA
Step 5. Submit a request to a stand-alone CA
Request a certificate
Advanced
Select Submit a certificate request by using a base-64-encoded CMC or PKCS #10 file, or submit a renewal request by using a base-64-encoded PKCS #7 file.
Step 6. approve the pending certificate request
[W2K8R2DC1.demo.stranger]
Click Pending Request in Certificate Authority
Click on Issue
Step 7. retrieve the certificate
View status of pending certificate request
Save certificate
Download certificate
Step 8. import the certificate into the certificate store
Step 9. import the certificate into Operations Manager using MOMCertImport
Note
On 64-bit computers, type cd\SupportTools\amd64
MOMCertImport /SubjectName OM12MS02.demo.stranger
Check if everything is ok
Open the certificate that you installed on management/gateway server. Click on Details Tab and check the Serial Number.
Now navigate to HKLM\Software\Microsoft\Microsoft Operations Manager\3.0\Machine Settings and check the value of ChannelCertificateSerialNumber. Serial number of certificate should be listed backwards here in registry.
Open registry
Tada!
Pre-reqs on DMZ server:
Make sure you have installed the OM12 Agent first before starting.
Let's check the eventlog
Repeat steps for OM12DWZ01 server in workgroup
[OM12DWZ01.demo.dmz]
Step 1. Download the Trusted Root (CA) certificate.
Step 2. Import the Trusted Root (CA) certificate
CertReq –New –f RequestConfig.inf CertRequest.req
[OM12DMZ01.demo.dmz]
MOMCertImport /SubjectName OM12DMZ01.demo.dmz
Final step is approving agent
Check Security Settings in Operations Console.
Wait for Agent to turn up in Pending Approval folder
End result:
Have fun at MMS for those who are in Vegas, and for those who are not, well…
I helped a customer creating a OpsMgr Monitor for checking if the there has been a SQL Full or Differential Backup within a specified number of hours. David Scheltens created the SQL query.
Remark: Please read information on System Center Central for more info on this article.
This is how you could create this kind of monitor in your own environment.
Steps:
<SimpleExpression>
<ValueExpression>
<XPathQueryType="Integer">Property[@Name='NumHours'] </XPathQuery>
</ValueExpression>
<Operator>Greater</Operator>
<ValueType="Integer">20</Value>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<Operator>LessEqual</Operator>
</SuccessExpression>
15. Enable the Monitor via an Override.
Remark: You may need to Use a Run As Account with the right permission for this Monitor.
In Operations Manager 2007, Run As Profiles and Run As Accounts are used to select users with the privileges needed for running rules, tasks, and monitors. Management Pack authors create a rule, task, or monitor, and then associate it with a Run As Profile. The named Run As Profile is imported along with the Management Pack into Operations Manager 2007.
The Operations Manager 2007 administrator creates a named Run As Account and specifies users and groups. The administrator then adds the Run As Account to the Run As Profile and specifies the target computers that the account should run on.
The goal in this short tutorial is to create a Timed Script Two State Monitor and associate a run as account to this monitor and save it all in a Management Pack. The Timed Script Two State Monitor is a vbscript that uses WMI to check if BizTalk orchestrations are not started.
I’ve got some great help from Jakub Oleksy (http://blogs.msdn.com/jakuboleksy/default.aspx) and Steve Wilson (http://www.authormps.com/dnn/)
You can download the tutorial here.
I finally found out the issue why this script was not working for everybody. It was because of the different versions of PowerShell. Now it should also work on PowerShell v2.
Another possible fix to the empty ComputerGroupsMembernames issue.
Last week I saw a request for a PowerShell script which would put all the members of a OM2012 Computer Group in Maintenance Mode, so this could be used with the Task Scheduler.
I know there are quite some alternative when it comes to putting instances in Maintenance Mode, but I thought it would be cool to create the mother-of-all maintenance mode PowerShell scripts for OM2012 :-)
This PowerShell script can be run standalone or scheduled with the Task Scheduler and has the following cool features:
Ok enough about the features, here is the script:
####################################################################################################################### # Puts a OM2012 Computer Group in Maintenance Mode using PowerShell # Author: Stefan Stranger (Microsoft) # Example usage: Run Get-Help Get-SCOMMaintenanceModeForGroups.ps1 -Examples # Disclamer: This program source code is provided "AS IS" without warranty representation or condition of any kind # either express or implied, including but not limited to conditions or other terms of merchantability and/or # fitness for a particular purpose. The user assumes the entire risk as to the accuracy and the use of this # program code. # Tested on PowerShell v3 and OM2012 environment # Date: 03-07-2012 # Name: Get-SCOMMaintenanceModeForGroups.ps1 # v1.000 - 03-07-2012 - Stefan Stranger - initial sstranger's release # v1.001 - 06-07-2012 - Stefan Stranger - Added Eventlog and WhatIf Switch # v1.003 - 07-11-2012 - Stefan Stranger - Fixed issue on PowerShell v2, Now works on v2 and v3 # v1.004 - 16-11-2012 - Stefan Stranger - Fixed issue with empty GroupMembershipNames issue######################################################################################################################## <# .SYNOPSIS Places all members of a SCOM Computer Group in into maintenance mode, and creates new active maintenance mode entries. .DESCRIPTION The Start-MaintenanceModeForGroups script places all members of a SCOM Computer Group into maintenance mode, and creates new active maintenance mode entries. When in maintenance mode, alerts, notifications, rules, monitors, automatic responses, state changes, and new alerts are suppressed for the class instance. .EXAMPLE Start-SCOMMaintenanceModeForGroup.ps1 -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -Verbose Puts all Members of the "All Windows Computer" Group in Maintenance Mode for 10 minutes, with Reason "UnplannedOther" and with Comment "Testing Maintenance Mode". Adding Verbose information. .EXAMPLE Start-SCOMMaintenanceModeForGroup.ps1 -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -Eventlog Puts all Members of the "All Windows Computer" Group in Maintenance Mode for 10 minutes, with Reason "UnplannedOther" and with Comment "Testing Maintenance Mode". Writing Eventlog information to the "Operations Manager" Eventlog (eventid 998 and eventid 999). Can be used for tracking and debugging when Task Scheduler is being used. .EXAMPLE Start-SCOMMaintenanceModeForGroup.ps1 -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -WhatIf Using the WhatIf switch shows which Members of the "All Windows Computer" Group would be put in Maintenance Mode if you had run the script. So the members are not really put into maintenance mode. For testing purposes. .PARAMETER ComputerGroup The SCOM Computer Group name for which members you want to put in Maintenance Mode. .PARAMETER EndTime Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. .PARAMETER Reason Specifies the reason for placing the resource into maintenance mode. Valid values are: UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity .Parameter Comment Allows you to type a comment about the maintenance activity. .Parameter EventLog Writes information to the "Operations Manager" Eventlog to track what is happening. .Link http://blogs.technet.com/stefan_stranger#> #requires -version 2.0 [CmdletBinding(SupportsShouldProcess=$true)] param ( [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='What is the ComputerGroup you want to put in Maintenance Mode?')] [Alias("Group")] [string[]]$ComputerGroup, [Parameter(Mandatory=$True, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$True, HelpMessage='Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. This is a required parameter')] [int]$EndTime, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity')] [string]$Reason, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='Allows you to type a comment about the maintenance activity.')] [string]$Comment, [switch]$EventLog ) set-strictmode -version latest $start=Get-Date $currentlog = $start.ToString() Write-Verbose "Starting $($myinvocation.mycommand)" Write-Verbose "Ready to put ComputerGroup $ComputerGroup in Maintenance Mode" Function Start-SCOMMaintenanceModeForGroup { <# .SYNOPSIS Sets a SCOM Group in Maintenance Mode .DESCRIPTION Sets the members of a SCOM Group in Maintenance Mode .EXAMPLE Start-SCOMMaintenanceModeForGroup -ComputerGroup "All Windows Computers" -EndTime 10 -Reason "UnplannedOther" -Comment "Testing Maintenance Mode" -Verbose .PARAMETER ComputerGroup The SCOM Computer Group name for which members you want to put in Maintenance Mode. .PARAMETER EndTime Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. .PARAMETER Reason Specifies the reason for placing the resource into maintenance mode. Valid values are: UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity .Parameter Comment Allows you to type a comment about the maintenance activity. .Link http://blogs.technet.com/stefan_stranger #> [CmdletBinding(SupportsShouldProcess=$true)] param ( [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='What is the ComputerGroup you want to put in Maintenance Mode?')] [Alias("Group")] [string[]]$ComputerGroup, [Parameter(Mandatory=$True, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$True, HelpMessage='Specifies the time the maintenance will end. The minimum amount of time a resource can be in maintenance mode is 5 minutes. This is a required parameter')] [int]$EndTime, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='UnplannedOther, PlannedHardwareMaintenance, UnplannedHardwareMaintenance, PlannedHardwareInstallation, UnplannedHardwareInstallation, PlannedOperatingSystemReconfiguration, UnplannedOperatingSystemReconfiguration, PlannedApplicationMaintenance, ApplicationInstallation, ApplicationUnresponsive, ApplicationUnstable, SecurityIssue, LossOfNetworkConnectivity')] [string]$Reason, [Parameter(Mandatory=$False, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='Allows you to type a comment about the maintenance activity.')] [string]$Comment, [switch]$EventLog ) Begin { Write-Verbose "Starting Function Start-SCOMMaintenanceModeForGroup Function" #Check for minumum Maintenance mode period of 5 mins. if($endtime -lt 5) { Write-Error "The time span for the maintenance mode should be at least 5 minutes." -ErrorAction Stop } Write-Verbose "Following Group Members will be put in Maintenance Mode:" $ComputerGroupMembers = Get-SCOMMonitoringObject -DisplayName $ComputerGroup if($ComputerGroupMembers) { #$ComputerGroupMemberNames = ($ComputerGroupMembers.getrelatedMonitoringObjects() | select DisplayName).DisplayName $ComputerGroupMemberNames = ($ComputerGroupMembers.getrelatedMonitoringObjects() | select DisplayName) Write-Verbose "$ComputerGroupMemberNames" #Retrieve Management Servers so we can check if we don't put Management Servers in MM. $MSs = Get-SCOMManagementServer } else { Write-Error "No Members of ComputerGroup $ComputerGroup found" -ErrorAction Stop } } #End Begin Process { #Put Agents in Maintenance Mode foreach ($agent in $ComputerGroupMembers.getrelatedMonitoringObjects()) { Write-Verbose "Checking if ComputerGroup Member $agent is not a Management Server" if(($MSs | Select DisplayName) -eq $agent) { Write-Verbose "We don't want to put a Management Server in MM. Skipping" } else { Write-Verbose "Let's put Agent $Agent in Maintenance Mode" $Instance = Get-SCOMClassInstance -Name $Agent if ($PSCmdlet.ShouldProcess("Putting $Agent in Maintenande Mode for $($Endtime) minutes") ) { #Added 5 seconds to EndTime to prevent failing the Start-SCOMMaintenanceMode cmdlet. Min. 5 mins is needed. Start-SCOMMaintenanceMode -Instance $Instance -EndTime ([System.DateTime]::Now).AddSeconds(5).addMinutes($EndTime) -Reason $Reason -Comment $Comment }#End of whatif }#End of else }#End Foreach if ($PSBoundParameters['EventLog']) { write-eventlog -LogName "Operations Manager" -Source "OpsMgr SDK Service" -EventID 999 -message "The following Objects are put into in Maintenance Mode for $($EndTime) minutes: $($ComputerGroupMembers.getrelatedMonitoringObjects())" }#End if } #End Process End { Write-Verbose "Finished Function Start-SCOMMaintenanceModeForGroup Function" } } #Main try { if ($PSBoundParameters['EventLog']) { write-eventlog -LogName "Operations Manager" -Source "OpsMgr SDK Service" -EventID 998 -message "The $($myinvocation.mycommand) is used to put Objects in Maintenance Mode" } Write-Verbose "Checking if OperationsManager Module is loaded" #Check if OperationsManager Module is loaded. if(!(Get-Module OperationsManager)) { Write-Verbose "Importing OperationsManager Module" Import-Module OperationsManager -ErrorAction Stop } Write-Verbose "Checking for OM2012 environment" #Check if OM2012 is being used. if(!(Get-Module OperationsManager).Description -eq "Operations Manager OperationsManagerV10 Module") { Write-Error "This script is only for OM2012" } #Call Function if ($PSBoundParameters['EventLog']) { Start-SCOMMaintenanceModeForGroup -ComputerGroup $ComputerGroup -EndTime $EndTime -Reason $Reason -Comment $Comment -EventLog } else { Start-SCOMMaintenanceModeForGroup -ComputerGroup $ComputerGroup -EndTime $EndTime -Reason $Reason -Comment $Comment } } #End Try catch [System.IO.FileNotFoundException] { "OperationsManager Module not found" $_.Exception.Message } catch { Write-Warning "Oops something went wrong" $_.Exception.Message } $end=Get-Date Write-Debug ("Total processing time {0}" -f ($end-$start).ToString()) Write-Verbose "Ending $($myinvocation.mycommand)"
You can use the Get-Help Get-SCOMMaintenanceModeForGroups.ps1 –full command in PowerShell to see the complete help for this script.
Example using the –WhatIf switch
Let’s do the real deal and put some members of my “Stefan – OM2012 Maintenance Computer Group” in Maintenance Mode for 5 minutes.
How do use this cool PowerShell script to schedule Maintenance Mode using the Task Scheduler?
Save script as: D:\Scripts\OM2012\Start-SCOMMaintenanceModeForGroups.ps1
Open TaskScheduler (on OM2012 Management Server or where you have installed the Operations Manager Console)
Create a new Task
Enter Name and make sure the user account under which the Scheduled Task is running is having enough permissions in SCOM. Select Run with Highest privileges.
Configure Trigger
Add action
Program/script: powershell.exe
Add argument (optional): D:\Scripts\OM2012\Start-SCOMMaintenanceModeForGroups.ps1 -ComputerGroup 'Stefan - OM2012 Maintenance Computer Group' -EndTime 5 -Reason "UnplannedOther" –Comment 'Testing MM' -Eventlog
Remark: Make sure you use single quotes of ComputerGroup, Reason or Comment Parameters if space are being used in the name.
Enter Credentials
If you have scheduled to script using the EventLog Switch toy can look in the Operations Manager Eventlog for auditing info.
You can download the script from the Script Center Repository: http://gallery.technet.microsoft.com/scriptcenter/Put-OM2012-Computer-Group-43902672
Have fun!
I know there are already quite some other blog posts about OpsMgr Data Warehouse Grooming. But I was helping a customer with grooming their OpsMgr Data Warehouse Database (OperationsManagerdw) and got some questions. And you may have the same questions but you are afraid to ask ;-)
--Current Grooming Settings USE OperationsManagerDW SELECT AggregationIntervalDurationMinutes, BuildAggregationStoredProcedureName, GroomStoredProcedureName, MaxDataAgeDays, GroomingIntervalMinutes, MaxRowsToGroom FROM StandardDatasetAggregation
--Last Grooming Time USE OperationsManagerDW select min(datetime) as MinDate, max(datetime) as MaxDate, datediff(d,min(datetime),max(datetime)) AS NoOfDaysInDataSet from Perf.vPerfHourly
--To view the number of days of total data of each type in the DW: USE OperationsManagerDW SELECT DATEDIFF(d, MIN(DWCreatedDateTime), GETDATE()) AS [Current Alert] FROM Alert.vAlert SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Event] FROM Event.vEvent SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Perf Raw] FROM Perf.vPerfRaw SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Perf Hourly] FROM Perf.vPerfHourly SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current Perf Daily] FROM Perf.vPerfDaily SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current State Raw] FROM State.vStateRaw SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current State Hourly] FROM State.vStateHourly SELECT DATEDIFF(d, MIN(DateTime), GETDATE()) AS [Current State Daily] FROM State.vStateDaily
--To view the oldest and newest recorded timestamps of each data type in the DW: USE OperationsManagerDW select min(DateTime) AS [Oldest Event Date] from Event.vEvent select max(DateTime) AS [Newest Event Date] from Event.vEvent select min(DateTime) AS [Oldest Perf Date]from Perf.vPerfRaw select max(DateTime) AS [Newest Perf Date]from Perf.vPerfRaw select min(DWCreatedDateTime) AS [Oldest Alert Date] from Alert.vAlert select max(DWCreatedDateTime) AS [Newest Alert Date] from Alert.vAlert
--Which Tables used the most space USE OperationsManagerDW 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) AS index_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
-- From http://ops-mgr.spaces.live.com/blog/cns!3D3B8489FCAA9B51!176.entry -- Alert Data:
USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 100 WHERE GroomStoredProcedureName = 'AlertGroom'
--Event Data: USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 40 WHERE GroomStoredProcedureName = 'EventGroom'
--Performance Data: USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 100 WHERE GroomStoredProcedureName = 'PerformanceGroom' AND AggregationIntervalDurationMinutes = '60'
USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 200 WHERE GroomStoredProcedureName = 'PerformanceGroom' AND AggregationIntervalDurationMinutes = '1440'
--State Data: USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 40 WHERE GroomStoredProcedureName = 'StateGroom' AND MaxDataAgeDays = 180
USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 100 WHERE GroomStoredProcedureName = 'StateGroom' AND AggregationIntervalDurationMinutes = '60'
USE OperationsManagerDW UPDATE StandardDatasetAggregation SET MaxDataAgeDays = 200 WHERE GroomStoredProcedureName = 'StateGroom' AND AggregationIntervalDurationMinutes = '1440'
Disclaimer
Please be very careful when changing your grooming settings, you can loose data ;-) Posts in this blog are provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified in the Terms of Use
Links to other blog posts about Grooming:
How often do you get the question: “What Monitors, Rules and Discoveries are running on an OpsMgr Agent?” from your co-workers? Especially when they don’t have a clue what is being monitored for their servers.
Most of the time you just use the EffectiveConfigurationViewer from the OpsMgr Resource Kit. It let’s you pick different objects, besides the Agents you are monitoring with OpsMgr.
It’s shows quite some interesting information and let’s you export the result to an XML file. But that’s not always your co-workers want’s to see. IMO they often want to have an Excel sheet with all the Monitors and Rules running on a specific Agent. That’s what they understand and can easily read.
What options do you have now?
Let’s look at the options.
Build some wrapper around the exported XML file
This is possible, but would not give us all the information we would like to see. It can only give us the Monitor/Rule or Discovery Name and it’s state. We are interested in much more, like: Name, Description, Type, Management Pack, Overrides, etc.
So let’s skip this option.
Use a third-party tool
In the next version of MP Studio a new feature called Silect’s Agent Explorer will be added. I’m lucky to be able to test the latest evaluation version of MP Studio and it will be able to give you almost all the information you probably need.
If you want to see what Monitors, Rules and Discoveries are running on an Agent, you can use the Explore workflow tasks feature (Agent Explorer) to view all workflows running on all agents or a specific server.
It will give you an overview of all Workflows running on a specified Agent and you can export the result to Excel.
This is almost what I want to see. The only thing I’m missing in the current Agent Explorer feature is if there are overrides configured for a Monitor, Rule or Discovery. I talked with Randy Roffey from Silect about this, and he told me that would be challenge, because there can be be multiple override settings for the same workflow. Good point, but it would be nice to see if there are any overrides for a workflow, than you can always manually check the configured overrides later.
PowerShell script that does the magic
The last option we have is to create a PowerShell script that does all we want. And what do we want? We want an Excel sheet with all Monitors, Rules and Discoveries running on an Agent, with their Type, DisplayName, Description, possible Override and ManagementPack.
Here you can see again 768 workflows running on the OpsMgr Agent (just like in MP Studio) but it also shows if there is an Override* being configured for the Monitor, Rule or Discovery. This still does not mean that the override is applicable for the Agent though.
* Retrieving the Override information can be a time (CPU and Memory) consuming exercise, so I commented that part of the PowerShell script.
Drawback I found using this script is the impact on the CPU and Memory when running this script and the time it takes before this script finishes. So you may take that into consideration when you run this script. First it retrieves all the Monitors, Rules and Discoveries and saves that in Memory and loops through this data in memory for finding the workflow information.
When I tested this script in my small OpsMgr 2007 R2 environment it took 1:47 seconds to run.
But it can also take much longer , like 27 minutes in another larger OpsMgr 2007 R2 environment.
If you are still interested to give the script a try, here it is:
############################################################################### # Get OpsMgr 2007 Running Workflows using PowerShell # This script retrieves the workflows running on an OpsMgr Agent # Authors: Jeremy Pavleck & Stefan Stranger (Microsoft) # Example usage (run from OpsMgr Command Shell): Get-OpsMgrWorkflows_v1.ps1 -agentname "myagent.contoso.com" | export-csv -path c:\temp\workflows.csv # Date: 30-11-2010 # Name: Get-AgentWorkflows_v1.ps1 # Remarks: Warning: Script is CPU and Memory intensive!! # Retrieving the overrides for the Monitors, Rules and Discoveries turned out to be a time, CPU and Memory consuming exercise and I disabled it. # You can enable it by Uncommenting that part of the script if you want to. # Script needs to run in PowerShell version 2. # v1.000 - 30/11/2010 - stefstr - initial sstranger's release ############################################################################### param ([string]$agentname = $(read-host "Please enter OpsMgr Agent Name")) function Get-AgentWorkflow($agentname) { #Original Script from Jeremy Pavleck. #http://www.pavleck.net/2008/06/sp1-gem-finding-rules-running-on-remote-agents/ #Use the OpsMgr Task Show Running Rules and Monitors. $taskobj = Get-Task | Where-Object {$_.Name -eq "Microsoft.SystemCenter.GetAllRunningWorkflows"} # Grab HealthService class object $hsobj = Get-MonitoringClass -name "Microsoft.SystemCenter.HealthService" # Find HealthService object defined for named server $monobj = Get-MonitoringObject -MonitoringClass $hsobj | Where-Object {$_.DisplayName -match $agentname} #Start Task GetAllRunningWorkflows $taskOut = Start-Task -Task $taskobj -TargetMonitoringObject $monobj [xml]$taskXML = $taskOut.OutPut #Get Workflows $workflows=$taskXML.selectnodes("/DataItem/Details/Instance/Workflow") #Retrieve Monitors $monitors = get-monitor #Retrieve Rules $rules = get-rule #Retrieve Discoveries" #Used the Group-object because there are some discovery rules with the same DisplayName $discoveries = get-discovery | select-object -Unique #Get Overrides" #monitoroverrides = foreach ($monitor in Get-ManagementPack | get-override | where {$_.monitor}) {get-monitor | where {$_.Id -eq $monitor.monitor.id}} #$rulesoverrides = foreach ($rule in Get-ManagementPack | get-override | where {$_.rule}) {get-rule | where {$_.Id -eq $rule.rule.id}} #$discoveryoverrides = foreach ($discovery in Get-ManagementPack | get-override | where {$_.discovery}) {get-discovery | where {$_.Id -eq $discovery.discovery.id}} #Check for each workflow if it's a Rule or Monitor or Discovery. foreach ($workflow in $workflows) { #Check for Monitor $monitor = $monitors | where-object {$_.Name -eq $workflow."#text"} if ($monitor -eq $null) { #Check for Rule $rule = $rules | where-object {$_.Name -eq $workflow."#text"} if ($rule -eq $null) { #Check for Discovery $discovery = $discoveries | where-object {$_.Name -eq $workflow."#text"} if ($discovery -eq $null) { } else { #Get ManagementPack $mp = $discovery.getmanagementpack() #Check if Discovery has an override #$flag = $discoveryoverrides | Where-Object {$_.DisplayName -eq $discovery.DisplayName} #if ($flag -eq $null) #{ # $override = "false" #} #else #{ # $override = "true" #} $discobject = new-object System.Management.Automation.PSObject $discobject = $discobject | add-member -membertype NoteProperty -name Type -value "Discovery" -passthru $discobject = $discobject | add-member -membertype NoteProperty -name DisplayName -value $discovery.DisplayName -passthru $discobject = $discobject | add-member -membertype NoteProperty -name Description -value $discovery.Description -passthru #$discobject = $discobject | add-member -membertype NoteProperty -name Override -value $override -passthru $discobject = $discobject | add-member -membertype NoteProperty -name ManagementPack -value $mp.DisplayName -passthru $discobject } } else { $mp = $rule.getmanagementpack() #Check if Rule has an override #$flag = $ruleoverrides | Where-Object {$_.DisplayName -eq $rule.DisplayName} #if ($flag -eq $null) #{ # $override = "false" #} #else #{ # $override = "true" #} $ruleobject = new-object System.Management.Automation.PSObject $ruleobject = $ruleobject | add-member -membertype NoteProperty -name Type -value "Rule" -passthru $ruleobject = $ruleobject | add-member -membertype NoteProperty -name DisplayName -value $rule.DisplayName -passthru $ruleobject = $ruleobject | add-member -membertype NoteProperty -name Description -value $rule.Description -passthru #$ruleobject = $ruleobject | add-member -membertype NoteProperty -name Override -value $override -passthru $ruleobject = $ruleobject | add-member -membertype NoteProperty -name ManagementPack -value $mp.DisplayName -passthru $ruleobject } } else { #Get ManagementPack for Monitor $mp = $monitor.getmanagementpack() #Check if Monitor has an override #$flag = $monitoroverrides | Where-Object {$_.DisplayName -eq $monitor.DisplayName} #if ($flag -eq $null) #{ # $override = "false" #} #else #{ # $override = "true" #} $monitorobject = new-object System.Management.Automation.PSObject $monitorobject = $monitorobject | add-member -membertype NoteProperty -name Type -value "Monitor" -passthru $monitorobject = $monitorobject | add-member -membertype NoteProperty -name DisplayName -value $monitor.DisplayName -passthru $monitorobject = $monitorobject | add-member -membertype NoteProperty -name Description -value $monitor.Description -passthru #$monitorobject = $monitorobject | add-member -membertype NoteProperty -name Override -value $override -passthru $monitorobject = $monitorobject | add-member -membertype NoteProperty -name ManagementPack -value $mp.DisplayName -passthru $monitorobject } } } Get-AgentWorkflow $agentname
This sample is not supported under any Microsoft standard support program or service. This sample is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of this sample and documentation
remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of this sample be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use this sample or documentation, even if Microsoft has been advised of the possibility of such damages.
Today I needed to compare two csv files with results from SQL queries from the OperationsManager database and the OperationsManagerDW database. I run the SQL queries on both OperationsManager databases and saved the result to a csv file. Now I needed to quickly compare the results from both csv files, and what better way than to use PowerShell.
Here is an example how you can use PowerShell to quickly compare two csv files:
First some example CSV files:
Example CSVFile1.csv
ManagementPackId,MPFriendlyName,MPName,mp.MPVersionDependentId,MPLastModified,MPKeyToken,ContentReadable 3A7609F3-A5AB-F205-5001-010EE387DD28,Customer - Exchange 2007 MP overrides,Customer.Exchange.MP.overrides,5D49AADA-DFEE-40DC-9A32-2758FC71B426,2011-01-06 16:39:57.517,NULL,1 49C911AC-337C-CD94-DD13-021E2CFDDAB0,Customer - SCOM MS,Customer.SCOM.MS,9FA54A57-B123-44AE-A9AB-ED1A1C4CDB35,2011-01-27 09:16:28.100,NULL,1 C0A4183F-4318-CB0C-EF5A-054B32AE33B4,Windows Server 2000 Operating System Overrides,Windows.Server.2000.Operating.System.Overrides,6293AED6-DE8F-462E-AD54-1F83F2E33F82,2011-02-04 14:38:19.330,NULL,1 3DFAC27F-8551-B71B-7DD2-30156A31CD92,Customer - Citrix Beheer - WIS Servers Events,Customer.Citrix.Beheer.WIS.Servers.Events,4496E575-C63C-4B45-BEF7-6216668264F7,2010-12-06 01:54:15.963,NULL,1 3AFE86A8-827C-CDB6-9A84-32C67483C3D1,Windows cluster management monitoring - overrides,Windows.cluster.management.monitoring.overrides,243D4B09-9455-4737-9880-399CF2700CF4,2011-02-04 16:07:11.377,NULL,1 6569E210-F188-EEF7-05CA-331859F4D8C6,Customer - Citrix Beheer,Customer.Citrix.Beheer,8109BB67-C923-4814-A1DB-F2A386B2389B,2011-01-17 13:58:08.690,NULL,1 8BDC857A-7F32-40A7-E5C2-4583E263B290,Customer - ISA server 2006,Customer.ISA.server,68F24CBA-B6C7-474B-A09B-03B0D730609B,2011-01-07 10:56:51.290,NULL,1 C39E8EF5-5E04-9CAE-F467-61D87ACD5E9E,Customer - Windows Server - SCCM,Customer.Windows.Server.SCCM,7BB1925D-007A-4621-BAD3-56F87B49C4C8,2011-01-17 13:02:28.880,NULL,1 A2B5CA86-96F7-F4CA-2152-63274CEF3336,Customer - Sharepoint Server,Customer.Sharepoint.Server,26E07753-0740-450F-972C-6A16C2099C12,2011-01-06 07:26:36.533,NULL,1 5BC992B2-96F6-E192-6E92-65FB5EC0CE5E,Customer - SQL Server (Monitoring),Customer.SQL.Server.Monitoring,2618C5C0-D89F-4E86-8259-FD7809D75E7C,2011-02-07 14:12:14.613,NULL,1 E4056BA9-CFC7-2D04-FF9B-67084CC15E83,Customer - Print Servers,Customer.Print.Servers,C336C3FD-CF15-4319-A33E-00F4BF2A390D,2010-11-24 10:14:22.660,NULL,1 3EECB872-CC4A-62BC-EA39-855EF594852D,Customer - Print Beheer Menu MP,Customer.Print.Beheer.Menu.MP,6F12D09D-0A55-40BA-A320-B571E9554ADE,2010-12-21 12:49:53.603,NULL,1 A2D688EC-8AE1-C4AF-A485-8564C214D292,Customer - Arcserve MP,Customer.Arcserve.MP,7AECFE66-51F6-4174-B84C-E918140F37F2,2010-12-03 11:51:39.080,NULL,1 A3542697-E0E7-E382-D40B-86ADEC512D79,Windows Server 2008 Operating System (Monitoring) Overrides,Windows.Server.2008.Operating.System.Monitoring.Overrides,20BCC6DC-F928-4108-B70F-873639A0448A,2010-12-16 12:16:40.800,NULL,1 070A0205-56D6-FF84-688A-8A216A47A949,Customer - Fileservers Dienst,Customer.Fileservers.Dienst,7DDF2381-3B13-4971-9E91-6656075C2E60,2010-12-22 09:26:50.683,NULL,1 98701ABB-AF93-7E5A-D121-9A18E0037CE8,Customer - DSA & PKI Gateways,Customer.DSA.PKI.Gateways,95B49F67-9514-4E80-991D-B3CF4EA2632F,2010-12-20 11:38:44.697,NULL,1 FA4FDEAF-E107-8AA3-BD2C-9E29C58C0C53,Customer - PKI Management,Customer.PKI.Management,6B677888-07F1-4725-BA3F-E742B20FA9C4,2011-01-27 08:45:23.153,NULL,1 51DA566A-1AC1-5DC9-3F66-A11FC439357C,nworks VMware Virtual Enterprise Monitoring MP,nworks.VMware.VEM,599A587E-3357-A127-50EF-198F04365ADA,2010-11-23 11:10:29.243,65c40f14a98ce59b,1 512DB9E6-D21A-2E4F-E987-A28BDE8F940B,Customer - Exchange availability,Customer.Exchange.availability,1D0DDA6B-9ED2-48C0-BFEE-1538DA9AE16F,2010-12-27 10:10:30.707,NULL,1 DD81FA7E-73BF-332B-C4B6-A767BB514BE8,Customer - Connect Direct,Customer.Connect.Direct,9C6BB3FD-6582-4F18-B18C-7BBE4DB9FCA6,2011-01-31 13:47:15.613,NULL,1 155A8BBB-C6D2-C706-DD1C-B7EFCCCC0E81,Customer - AD Beheer,Customer.AD.Beheer,CF036BAA-47C0-4D09-A2F4-25B3DC1F78B9,2011-01-05 13:17:15.520,NULL,1 E2296ED5-DDBC-EBC7-3881-C5288ADAA7CF,Microsoft Exchange Server 2010 Management Pack,Microsoft.Exchange.2010,AB06EB14-EAF1-0F0B-04B8-F1CDD33F4ACC,2011-02-04 09:02:29.607,31bf3856ad364e35,1 9E138797-AE1C-AF6E-E61B-D110253B417C,Engyro Connector TEC,Engyro.Connector.TEC.MP,76306617-5F13-42EB-9F3B-B948F18DC4D8,2010-11-23 11:29:55.980,NULL,1 A3C3E706-795F-BF80-DFC2-DBB4BDDFA919,Customer - ACS Management Pack,Customer.ACS.Management.Pack,D7C4F7A2-B18D-454F-8615-22CEC4EFDFCA,2011-01-04 12:30:01.593,NULL,1 7C2A6181-B7B9-89C2-6FC3-EDB760FCEFC1,Microsoft Exchange Server 2007 CAS Monitoring - Override,Microsoft.Exchange.Server.CAS.Monitoring.Override,BA79A086-E992-4AB7-B4B6-933FB8AD1211,2011-01-07 12:39:36.870,NULL,1
Example CSVFile2.csv
ManagementPackId,MPFriendlyName,MPName,mp.MPVersionDependentId,MPLastModified,MPKeyToken,ContentReadable 3A7609F3-A5AB-F205-5001-010EE387DD28,Customer - Exchange 2007 MP overrides,Customer.Exchange.MP.overrides,5D49AADA-DFEE-40DC-9A32-2758FC71B426,2011-01-06 16:39:57.517,NULL,1 49C911AC-337C-CD94-DD13-021E2CFDDAB0,Customer - SCOM ,Customer.SCOM,9FA54A57-B123-44AE-A9AB-ED1A1C4CDB35,2011-01-27 09:16:28.100,NULL,1 C0A4183F-4318-CB0C-EF5A-054B32AE33B4,Windows Server 2000 Operating System Overrides,Windows.Server.2000.Operating.System.Overrides,6293AED6-DE8F-462E-AD54-1F83F2E33F82,2011-02-04 14:38:19.330,NULL,1 F37D0C95-F313-4EC9-5385-0F41BFCFE55D,Customer Custom Monitoring,Customer.Custom.Monitoring,44597F97-6FD4-4D2E-B01E-5CDB9B218E50,2011-01-27 08:52:20.377,NULL,1 75E3375E-B1CD-4641-E86B-2664A7E7E7C2,Customer - Microsoft Exchange 2010 Override MP,Customer.Microsoft.Exchange.Override.MP,6DC9439A-BD4C-46C0-8D2F-080029042A6D,2011-02-04 11:12:40.857,NULL,1 3DFAC27F-8551-B71B-7DD2-30156A31CD92,Customer - Citrix Beheer - WIS Servers Events,Customer.Citrix.Beheer.WIS.Servers.Events,4496E575-C63C-4B45-BEF7-6216668264F7,2010-12-06 01:54:15.963,NULL,1 3AFE86A8-827C-CDB6-9A84-32C67483C3D1,Windows cluster management monitoring - overrides,Windows.cluster.management.monitoring.overrides,243D4B09-9455-4737-9880-399CF2700CF4,2011-02-04 16:07:11.377,NULL,1 6569E210-F188-EEF7-05CA-331859F4D8C6,Customer - Citrix Beheer,Customer.Citrix.Beheer,8109BB67-C923-4814-A1DB-F2A386B2389B,2011-01-17 13:58:08.690,NULL,1 B5FE879F-CD35-DD9A-7464-36401ABB9205,Microsoft Exchange 2010 Report Library,Microsoft.Exchange.2010.Reports,112EA102-A45A-9AA9-C84D-1ED9A56E8C61,2011-02-04 10:31:14.137,31bf3856ad364e35,1 DA187E72-B9D7-9E16-D098-3B0A624DC38C,My Default Management Pack,Microsoft.SystemCenter.OperationsManager.DefaultUser,497CE20F-02AF-417E-97B1-363F311CF739,2011-02-03 16:37:16.093,NULL,1 8BDC857A-7F32-40A7-E5C2-4583E263B290,Customer - ISA server 2006,Customer.ISA.server,68F24CBA-B6C7-474B-A09B-03B0D730609B,2011-01-07 10:56:51.290,NULL,1 C39E8EF5-5E04-9CAE-F467-61D87ACD5E9E,Customer - Windows Server - SCCM,Customer.Windows.Server.SCCM,7BB1925D-007A-4621-BAD3-56F87B49C4C8,2011-01-17 13:02:28.880,NULL,1 A2B5CA86-96F7-F4CA-2152-63274CEF3336,Customer - Sharepoint Server,Customer.Sharepoint.Server,26E07753-0740-450F-972C-6A16C2099C12,2011-01-06 07:26:36.533,NULL,1 5BC992B2-96F6-E192-6E92-65FB5EC0CE5E,Customer - SQL Server (Monitoring),Customer.SQL.Server.Monitoring,2618C5C0-D89F-4E86-8259-FD7809D75E7C,2011-02-07 14:12:14.613,NULL,1 E4056BA9-CFC7-2D04-FF9B-67084CC15E83,Customer - Print Servers,Customer.Print.Servers,C336C3FD-CF15-4319-A33E-00F4BF2A390D,2010-11-24 10:14:22.660,NULL,1 336987CD-60EF-5014-F384-7D37DE784858,Nworks Overrides,Nworks.Overrides,5EF45858-0DC1-4E67-9AFD-F70A2446CCA9,2011-01-25 10:20:27.143,NULL,1 3EECB872-CC4A-62BC-EA39-855EF594852D,Customer - Print Beheer Menu MP,Customer.Print.Beheer.Menu.MP,6F12D09D-0A55-40BA-A320-B571E9554ADE,2010-12-21 12:49:53.603,NULL,1 A2D688EC-8AE1-C4AF-A485-8564C214D292,Customer - Arcserve MP,Customer.Arcserve.MP,7AECFE66-51F6-4174-B84C-E918140F37F2,2010-12-03 11:51:39.080,NULL,1 A3542697-E0E7-E382-D40B-86ADEC512D79,Windows Server 2008 Operating System (Monitoring) Overrides,Windows.Server.2008.Operating.System.Monitoring.Overrides,20BCC6DC-F928-4108-B70F-873639A0448A,2010-12-16 12:16:40.800,NULL,1 070A0205-56D6-FF84-688A-8A216A47A949,Customer - Fileservers Dienst,Customer.Fileservers.Dienst,7DDF2381-3B13-4971-9E91-6656075C2E60,2010-12-22 09:26:50.683,NULL,1 98701ABB-AF93-7E5A-D121-9A18E0037CE8,Customer - DSA & PKI Gateways,Customer.DSA.PKI.Gateways,95B49F67-9514-4E80-991D-B3CF4EA2632F,2010-12-20 11:38:44.697,NULL,1 FA4FDEAF-E107-8AA3-BD2C-9E29C58C0C53,Customer - PKI Management,Customer.PKI.Management,6B677888-07F1-4725-BA3F-E742B20FA9C4,2011-01-27 08:45:23.153,NULL,1 51DA566A-1AC1-5DC9-3F66-A11FC439357C,nworks VMware Virtual Enterprise Monitoring MP,nworks.VMware.VEM,599A587E-3357-A127-50EF-198F04365ADA,2010-11-23 11:10:29.243,65c40f14a98ce59b,1 512DB9E6-D21A-2E4F-E987-A28BDE8F940B,Customer - Exchange availability,Customer.Exchange.availability,1D0DDA6B-9ED2-48C0-BFEE-1538DA9AE16F,2010-12-27 10:10:30.707,NULL,1 DD81FA7E-73BF-332B-C4B6-A767BB514BE8,Customer - Connect Direct,Customer.Connect.Direct,9C6BB3FD-6582-4F18-B18C-7BBE4DB9FCA6,2011-01-31 13:47:15.613,NULL,1 155A8BBB-C6D2-C706-DD1C-B7EFCCCC0E81,Customer - AD Beheer,Customer.AD.Beheer,CF036BAA-47C0-4D09-A2F4-25B3DC1F78B9,2011-01-05 13:17:15.520,NULL,1 E2296ED5-DDBC-EBC7-3881-C5288ADAA7CF,Microsoft Exchange Server 2010 Management Pack,Microsoft.Exchange.2010,AB06EB14-EAF1-0F0B-04B8-F1CDD33F4ACC,2011-02-04 09:02:29.607,31bf3856ad364e35,1 9E138797-AE1C-AF6E-E61B-D110253B417C,Engyro Connector TEC,Engyro.Connector.TEC.MP,76306617-5F13-42EB-9F3B-B948F18DC4D8,2010-11-23 11:29:55.980,NULL,1 A3C3E706-795F-BF80-DFC2-DBB4BDDFA919,Customer - ACS Management Pack,Customer.ACS.Management.Pack,D7C4F7A2-B18D-454F-8615-22CEC4EFDFCA,2011-01-04 12:30:01.593,NULL,1 7C2A6181-B7B9-89C2-6FC3-EDB760FCEFC1,Microsoft Exchange Server 2007 CAS Monitoring - Override,Microsoft.Exchange.Server.CAS.Monitoring.Override,BA79A086-E992-4AB7-B4B6-933FB8AD1211,2011-01-07 12:39:36.870,NULL,1 94DDD8EA-2A12-9E54-9545-F4A926DBACF0,System Center Core Monitoring Overrides,System.Center.Core.Monitoring.Overrides,BA527C6E-0E2C-440C-9358-6D073BBD4722,2010-12-07 07:25:25.517,NULL,1
Now we can compare both files with the use of the compare-object cmdlet in PowerShell.
$file1 = import-csv -Path "C:\temp\Test1.csv" $file2 = import-csv -Path "C:\temp\Test2.csv" Compare-Object $file1 $file2 -property MPFriendlyName -IncludeEqual
Have fun with PowerShell and the compare-object cmdlet.
(stefan.stranger).gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False Object[] Crappy.Planner
There are so many tools currently developed that it is hard to know where to find them. Here is a list that I know of maybe it’s helpful to you.
Please let me know if I’m missing one.
This article describes how to troubleshoot OpsMgr 2007 Event 21402, which indicates a script error or warning. However the article is intended to be an example for other events, since a lot of details are also in other events (like Workflow name).
Event Type: Warning Event Source: Health Service Modules Event ID: 21402 Description: Forced to terminate the following process started at 12:08:50 PM because it ran past the configured timeout 120 seconds.
With this article you will find
The query to find the discovery, monitor or rule should work for every event where the workflow name is listed. The script content is more specific to 21402 but might give an impression on how to retrieve content from an XML columns (of NVARCHAR type).
The queries aren't tested for performance, so the best course is to import the MP of the customer in your test environment and run them on your own machine.
An example of 21402 is
Event Type: Warning Event Source: Health Service Modules Event Category: None Event ID: 21402 Date: 7-4-2008 Time: 4:05:34 User: N/A Computer: server01 Description: Forced to terminate the following process started at 04:05:04 because it ran past the configured timeout 30 seconds. Command executed: "C:\WINDOWS\system32 \cscript.exe" /nologo "C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 297\177 \CheckVirtualMachineNameMatchComputerName.vbs" Working Directory: C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 297\177\ One or more workflows were affected by this. Workflow name: Microsoft.Virtualization.VirtualServer.2005R2.VirtualMachineName_does_not_match_computer_name.rule Instance name: servern01.contoso.com Instance ID: {3B3FA6E2-BB6B-CD49-274A-8722250C3D0C} Management group: OpsMgrdemo For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Command Executed:
"C:\WINDOWS\system32cscript.exe" /nologo "C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 297\177\CheckVirtualMachineNameMatchComputerName.vbs"
Working Directory:
C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 297\177\
Script:
CheckVirtualMachineNameMatchComputerName.vbs
Workflow:
Microsoft.Virtualization.VirtualServer.2005R2.VirtualMachineName_does_not_match_computer_name.rule
To find out which discovery monitor or rule the script belongs to run the following SQL script (based on the example event above) on the OperationsManager database.
DECLARE @ObjectName NVARCHAR(256) SET @ObjectName = 'Microsoft.Virtualization.VirtualServer.2005R2.VirtualMachineName_does_not_match_computer_name.rule' IF EXISTS (SELECT 1 FROM DiscoveryView WITH (NOLOCK) WHERE Name = @ObjectName) SELECT 'Discovery' As 'Object Type', d.DisplayName AS 'Displayname in Console', d.Name AS 'Internal Monitor Name', d.Id AS 'MonitorId', p.Displayname AS 'ManagementPack', p.Version AS 'ManagementPack Version', p.Name AS 'Management Pack Library Name' FROM DiscoveryView d WITH (NOLOCK) INNER JOIN ManagementPackView p WITH (NOLOCK) ON d.ManagementPackId = p.Id WHERE d.Name = @ObjectName ELSE IF EXISTS (SELECT 1 FROM MonitorView WITH (NOLOCK) WHERE Name = @ObjectName) SELECT 'Monitor' AS 'Object Type', m.DisplayName AS 'Displayname in Console', m.Name AS 'Internal Monitor Name', m.Id AS 'MonitorId', p.Displayname AS 'ManagementPack', p.Version AS 'ManagementPack Version', p.Name AS 'Management Pack Library Name' FROM MonitorView m WITH (NOLOCK) INNER JOIN ManagementPackView p WITH (NOLOCK) ON m.ManagementPackId = p.Id WHERE m.Name = @ObjectName ELSE IF EXISTS (SELECT 1 FROM RuleView WITH (NOLOCK) WHERE Name = @ObjectName) SELECT 'Rule' AS 'Object Type', r.DisplayName AS 'Displayname in Console', r.Name AS 'Internal Rule Name', r.Id AS 'RuleId', p.Displayname AS 'ManagementPack', p.Version AS 'ManagementPack Version', p.Name AS 'Management Pack Library Name' FROM RuleView r WITH (NOLOCK) INNER JOIN ManagementPackView p WITH (NOLOCK) ON r.ManagementPackId = p.Id WHERE r.Name = @ObjectName
This will give the following results
In the OpsMgr Console / Authoring you can find the Discovery, Monitor or Rule (depending on Object Type) in Management Pack Objects.
To retrieve the script you can run the following SQL query on the OperationsManager database.
SELECT ManagementPackId, ScriptName, ScriptFile FROM ( SELECT ManagementPackId, Script.Col.value('(Name/text())[1]', 'NVARCHAR(128)') AS ScriptName, Script.Col.value('(Contents/text())[1]', 'NVARCHAR(MAX)') AS ScriptFile FROM (SELECT ManagementPackId, CONVERT(XML, MPXML) AS MPXMLFormat, MPName FROM ManagementPack) p CROSS APPLY p.MPXMLFormat.nodes('//File') Script(Col) WHERE p.MPName LIKE '%2005R2%') s WHERE s.ScriptName = 'CheckVirtualMachineNameMatchComputerName.vbs'
Take note that SQL 2005 Studio has a limit of (about) 8000 char for its return results. Also since the MPXML field of the ManagementPack table is not of type XML but NVARCHAR, the formatting isn't really fancy. However it might give you a quick impression of what the script is about.
If people find this a useful query, I can work out one which gives a nice formatted output of the script content.
If you want to see how it is build up and configured in XML than
This looks like
<Rule ID="Microsoft.Virtualization.VirtualServer.2005R2.VirtualMachineName_does_not_match_computer_name.rule" Enabled="true" Target="Windows! Microsoft.Windows.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100"> <Category>AvailabilityHealth</Category> <DataSources> <DataSource ID="DS" TypeID="Microsoft.Virtualization.VirtualServer.2005R2.CheckVirtualMachineName"> <IntervalInSeconds>60</IntervalInSeconds> <Expression> <And> <Expression> <SimpleExpression> <ValueExpression> <XPathQuery Type="String">Property[@Name='IsVirtualMachine']</XPathQuery> </ValueExpression> <Operator>Equal</Operator> <ValueExpression> <Value Type="String">True</Value> </ValueExpression> </SimpleExpression> </Expression> ...
Here you find all the properties of the (in this case) the rule. Actually you can read the workflow of this object here. One part of the workflow is the Databasource ModuleType
<DataSource ID="DS" TypeID="Microsoft.Virtualization.VirtualServer.2005R2.CheckVirtualMachineName">
This points to the ModulesType part of the XML file
<ModuleTypes> <DataSourceModuleType ID="Microsoft.Virtualization.VirtualServer.2005R2.VirtualServerVirtualMachineDiscovery" Accessibility="Internal" Batching="false"> <DataSourceModuleType ID="Microsoft.Virtualization.VirtualServer.2005R2.RelVirtualMachineComputerDiscovery" Accessibility="Internal" Batching="false"> <DataSourceModuleType ID="Microsoft.Virtualization.VirtualServer.2005R2.VirtualMachineComputerDiscovery" Accessibility="Internal" Batching="false"> <DataSourceModuleType ID="Microsoft.Virtualization.VirtualServer.2005R2.VirtualMachineState" Accessibility="Internal" Batching="false"> <DataSourceModuleType ID="Microsoft.Virtualization.VirtualServer.2005R2.CheckVirtualMachineName" Accessibility="Internal" Batching="false"> <Configuration> <IncludeSchemaTypes> <SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType> </IncludeSchemaTypes> <xsd:element name="IntervalInSeconds" type="xsd:integer" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> <xsd:element name="Expression" type="ExpressionType" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> </Configuration> <OverrideableParameters> <OverrideableParameter ID="IntervalInSeconds" Selector="$Config/IntervalInSeconds$" ParameterType="int" /> </OverrideableParameters> ....
Here you will find the Module itself which is executed
<MemberModules> <DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource"> <IntervalSeconds>$Config/IntervalInSeconds$</IntervalSeconds> <ApplicationName>%windir%\system32\cscript.exe</ApplicationName> <WorkingDirectory /> <CommandLine>/nologo $file/CheckVirtualMachineNameMatchComputerName.vbs$</CommandLine> <TimeoutSeconds>30</TimeoutSeconds> <RequireOutput>true</RequireOutput> <Files> <File> <Name>CheckVirtualMachineNameMatchComputerName.vbs</Name> <Contents> ' Copyright (c) Microsoft Corporation. All rights reserved. ' VBScript source code ' CheckVirtualMachineNameMatchComputerName.vbs ' Arg 0 : SourceID Option Explicit Const StrVMMManagementGroupInstallationRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Setup\InstallPath" Const StrVirtualServerRegKey = "HKLM\System\CurrentControlSet\Services\Virtual Server\Start" Const StrVMMServerInstallationRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Setup\InstallPath" Const StrVMMServerVersionRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Setup\ProductVersion" Const StrVMMSelfServiceServerInstallationRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Self-Service Portal\Setup\InstallPath" Const StrVMMSSsiteEngineMachineRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Self-Service Portal\Settings\VmmServerName" Const StrVMMDatabaseServerRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Settings\Sql\OnRemoteServer" Const StrVMMDatabaseNameRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Settings\Sql\DatabaseName" Const StrVMMDatabaseInstanceRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Settings\Sql\InstanceName" Const StrVMMRemoteDatabaseMachineFQDNRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Server\Settings\Sql\MachineFQDN" Const StrVMMConsoleInstallationRegKey = "HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager 2007 Administrator Console\Setup\InstallPath" Const StrVMNameRegKey = "HKLM\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters\VirtualMachineName" Const StrWebsitDisplayName = "Microsoft System Center Virtual Machine Manager 2007 Self-Service Portal" Const StrSQLServerDefaultInstance = "MSSQLSERVER" Const StrEmpty = "" Const StrFolderSeparator = "\" Const StrLocationHost = "Host" Const StrLocationLibrary = "Library" '============= ' Method: ReadRegistry ' Description: This function read the regiestry, return true if the registry exit; otherwise return false '============= Function ReadRegistry(ByVal regString, ByRef regValue) Dim bHasRegistry Dim oReg Set oReg = CreateObject("WScript.Shell") On Error Resume Next regValue = oReg.RegRead(regString) If Err.number <> 0 Then bHasRegistry = False Else bHasRegistry = True End If On Error Goto 0 ReadRegistry = bHasRegistry End Function Call Main() ...
Have you ever looked for a way to delete an Attribute you created (by accident)? I did today, when I was making some documentation about a Management Pack I created.
As you can see there is no Delete option in the Authoring Pane of the OpsMgr Console.
So what’s the easiest and fasted way to delete an OpsMgr Attribute?
Answer: Using the Authoring Console.
How?
Because Kevin Holman has not published a blog article on the latest release of the Update Rollup 3 for System Center 2012 for Operations Manager 2012 I thought why should not I do it this time
And to be honest this time was a little different then I’ve implemented updates in years. Why?
Because this UR3 is automatically installed via Windows Update if you have enabled Windows Updates on all your OpsMgr 2012 machines off course.
Let’s first have a look at what has been fixed in this UR3 for System Center Operations Manager 2012 (KB2750631)
Not that much has been fixed in the UR3 but we still want to check if our machines have these fixes installed and if we need to do some steps our selves.
How do I check if these fixes have been installed via Windows Update?
That’s pretty easy, just go to your OpsMgr 2012 servers and open Windows Update and have a look at the Update History
Let’s have a look at one of my Management Servers:
You can also use PowerShell if you want using the following commands:
Get-Content $env:windir\windowsupdate.log | Where-Object { $_ -like '*successfully installed*Update Rollup 3 for System Center 2012*'} | Foreach-Object { $_ | select @{L="InstallDate";E={$_.Split("`t")[0]}}, @{L="Description";E={$_.Split("`t")[16]}} } | Format-Table * -Wrap
And this is the result on my other Management Server:
You can also look at the file version for some of the updated files, just like Kevin showed you in his previous posts on Update Rollups.
Checking the updated files for the Management Server Role:
Get-ItemProperty -Path "c:\Program Files\System Center 2012\Operations Manager\Server\*.dll" | select -ExpandProperty VersionInfo | where {$_.FileVersion -eq "7.0.8560.1036"} | Format-List FileName, FileVersion
You should see files with a File Version of 7.0.8560.1036
This means that the Management Server UR3 update has been installed on this Management Server.
Checking the updated files for the Web Console Role:
Checking the updated files for the Console Role:
Checking if the following Management Packs are updated:
The Management Packs for UR3 can be found in the following folder:
C:\Program Files\System Center 2012\Operations Manager\Server\Management Packs for Update Rollups
In this folder you find the following Management Pack files:
Microsoft.SystemCenter.DataWarehouse.Library.mp (version 7.0.8427.1)
Microsoft.SystemCenter.Visualization.Library.mpb (version 7.0.8560.1036)
When you check if these Management Packs are already installed this does not seem the case.
So we need to install the latest Management Packs Microsoft.SystemCenter.Visualization.Library and Microsoft.SystemCenter.WebApplicationSolutions.Library from the UR3 update manually using PowerShell.
Remark: During one the previous Update Rollups my Microsoft.SystemCenter.DataWarehouse.Library.mp (version 7.0.8427.1) was already updated to version 7.0.8427.1.
PS C:\Program Files\System Center 2012\Operations Manager\Server\Management Packs for Update Rollups> Get-ChildItem -Filter *.mpb | Import-SCOMManagementPack -PassThru
Latest MPs have been installed.
Checking if the Agents are updated with the latest updates:
Check the Pending Management Pane for Agents that need an update.
Approve Agent using PowerShell
Now I only need to install manually the UR3 update on my Agent in my DMZ.
Have fun with UR3!
Links:
SQL Nexus is a tool that helps you identify the root cause of SQL Server performance issues. It loads and analyzes performance data collected by SQLDiag and PSSDiag. It can dramatically reduce the amount of time you spend manually analyzing data.
With the RML Utilities you can answer questions such as the following:
If you think you have OpsMgr SQL Server performance issues maybe SQL Nexus together with SQLDiag and RML Utilities can help with performance tuning and analysis.
I want to thank David Scheltens for showing me how to use SQL Nexus and creating the PerfStatsScripts.
References:
SQLNexus
http://www.codeplex.com/sqlnexus
SQLDiag (installed default with SQL2005 and SQL2008)
http://msdn.microsoft.com/en-us/library/ms162833(SQL.90).aspx
PSSDiag (to use with SQL2000)
http://msdn.microsoft.com/en-us/library/aa175399(SQL.80).aspx
RML Utilities
http://blogs.msdn.com/psssql/archive/2007/12/18/rml-utilities-for-microsoft-sql-server-released.aspx
Today we released the Microsoft Script Explorer for Windows PowerShell (pre-release).
Microsoft Script Explorer for Windows PowerShell (pre-release) helps scripters find Windows PowerShell scripts, snippets, modules, and how-to guidance in online repositories such as the TechNet Script Center Repository, PoshCode, local or network file systems and Bing Search Repository.
Supported Operating Systems: Windows 7 Service Pack 1, Windows 8 Consumer Preview, Windows Server 2008 R2 SP1, Windows Server 2008 Service Pack 2, Windows Server 8 Beta, Windows Vista Service Pack 2
Additional Requirements:
This software is a pre-release version. Features and behavior are likely to change before the final release. This preview release is designed to enable the community to experience and review the preliminary designs and direction of key features in Microsoft Script Explorer and to solicit feedback before features are finalized. If you have additional questions, need help in troubleshooting issues, and other product features visit the Microsoft Script Explorer Forum on TechNet. Your feedback is important to us. Help improving Script Explorer by submitting bugs and suggestions to Microsoft Script Explorer Forum on TechNet.
And start searching for your PowerShell scripts.
Please give use feedback on the Microsoft Script Explorer Forum on TechNet.
Thanks!
Today I’m rebuilding some of my demo servers in my demo environment and before I can install the software, some pre-requisites need to be checked. You need to check if some Windows Server Roles are installed before starting the installation.
Off course you can just use the Server Manager to check the Roles and if necessary install the missing server roles.
c
But it’s much cooler to use PowerShell to check if you have installed the needed server roles
Just open Windows PowerShell, load the ServerManager Module and run the Get-WindowsFeature Cmdlet. That’s all to it.
And if you want to can also add the missing roles using the Add-WindowsFeature Cmdlet.
Have fun learning PowerShell!
Sitting at the McCarran International Airport waiting for my flight to Amsterdam (the Netherlands) I had some time to kill so I wrote a simpel PowerShell script which helps to easily download the MMS 2013 sessions from the Channel 9 RSS feed.
Using the Out-GridView Cmdlet you can easily select the sessions you are interested in. Click on Ok when finished selecting the sessions you are interested in downloading.
After creating my initial version I got some feedback that sometimes the script did not work and with the help of Jamie Moyer (also a Senior PFE like me) we made the script more robust and added extra features like a HTML Report overview.
You can even use the –verbose switch and other parameters to tweak the download folder. We hope you like the improvements.
####################################################################################################################### # Description: Download MMS 2013 Channel 9 videos # PowerShell version: 3 # Author(s): Stefan Stranger (Microsoft) # Jamie Moyer (Microsoft # Example usage: Run Get-MMS2013Channel9Videos.ps1 -path c:\temp -verbose # Select using the Out-Gridview the videos you want to download and they are stored in your myvideos folder. # You can multiple select videos, holding the ctrl key. # Disclamer: This program source code is provided "AS IS" without warranty representation or condition of any kind # either express or implied, including but not limited to conditions or other terms of merchantability and/or # fitness for a particular purpose. The user assumes the entire risk as to the accuracy and the use of this # program code. # Date: 04-13-2012 # Name: Get-MMS2013Channel9Videos.ps1 # Version: v1.001 - 04-14-2012 - Stefan Stranger - initial release # Version: v1.005 - 04-29-2013 - Jamie Moyer, Stefan Stranger - added more robustness and HTML Report ######################################################################################################################## #requires -version 3.0 [CmdletBinding()] Param ( # Path where to store video's locally [Parameter(Mandatory=$false, Position=0)] $Path = [environment]::getfolderpath("myvideos") + "\MMS2013", [Parameter(Mandatory=$false, Position=1)] $rssfeed = "http://channel9.msdn.com/Events/MMS/2013/RSS" ) function Get-NewFileName($name) { Write-Verbose "Calling Get-NewFileName Function" $r=$Path+"\"+(($name -replace "[^\w\s\-]*") -replace "\s+") + ".wmv";$r } Write-Verbose "Remove last slash if added using the downloaddirectory Parameter" if ($path.EndsWith("\")){$path = $path.Substring(0,$path.Length-1)} write-verbose "Path is: $path" Write-Verbose "Checking if Download directory $Path exists" if(!(test-path $Path -PathType Container)) { Write-Verbose "Creating $Path" New-Item -ItemType Directory $Path | Out-Null } Write-Verbose "Downloading RSS Feed Items from $rssfeed" $feeditems = Invoke-RestMethod $rssfeed [array]$feeditemsWithDetails = $feeditems | select Title, Summary, Duration, Enclosure,creator | Add-Member -MemberType ScriptProperty -Name AlreadyDownloaded -Value {(test-path("$Path\$($this.enclosure.url.split('/')[6])"))} -PassThru -Force | Add-Member -MemberType ScriptProperty -Name Destination -Value {("$Path\$($this.enclosure.url.split('/')[6])")} -PassThru -Force | Add-Member -MemberType ScriptProperty -Name Source -Value {$this.enclosure.url} -PassThru -Force | select AlreadyDownloaded,Title, Summary, Duration, Enclosure,Source,Destination,creator | sort Title Write-Verbose "Add all already downloaded items back to the list" $duplicateVideoNames = $feeditemsWithDetails |sort name| group destination | where-object {$_.Name -ne "" -and $_.Count -gt 1} | ForEach-Object {$_.Group} Write-Verbose "Remove the posts with duplicate file names from the feeditemsSelected array" $feeditemsSelected = @($feeditemsSelected | Where-Object {$duplicateVideoNames -notcontains $_}) Write-Verbose "Change video names to filenames, check to see if they are downloaded already and added them back to the array with updated details" $duplicateVideoNames | foreach-object { $newDestination = Get-NewFileName $_.Title $_.Destination = $newDestination $_.AlreadyDownloaded = (Test-Path $newDestination) $feeditemsWithDetails += $_ } Write-Verbose "Open Out-GridView to select vidoes to download" [array]$feeditemsSelected = $feeditemsWithDetails| Out-GridView -PassThru | select AlreadyDownloaded,Title, Summary, Duration, Enclosure,Source,Destination Write-Verbose "Downloading videos" $feeditemsSelected |Where-Object{!(Test-Path $_.Destination)} | select Source,Destination | Start-BitsTransfer -Priority Normal | Out-Null Write-Verbose "Add all already downloaded items back to the list" $feeditemsWithDetails | where-object {$_.AlreadyDownloaded} | foreach-object { if(-not [bool]($feeditemsSelected | Select-String $_.Title -Quiet)) { $feeditemsSelected += $_ } } Write-Verbose "Create HTML Report" $feeditemsSelected | sort Name | Out-Null $html = $feeditemsSelected |?{Test-Path "$($_.Destination)"} | % {@" <H4><a href="$($_.Destination)">$($_.Title)</a></H4> <H5>Speaker(s): $($_.creator)</H5> <H5>$($_.Summary)</H5> "@} Write-Verbose "Open HTML Report" ConvertTo-Html -Head "<h1>My Downloaded MMS Videos - $($feeditemsSelected.Count) Downloaded</h1>" -Body $html | Out-File $Path\MyMMSContent.html;start "$Path\MyMMSContent.html"
I’m currently busy with learning more about Crossplatform monitoring with OpsMgr 2007 R2 and stumbled on Logging on the Unix Agent for troubleshooting issues. As you may know on the Linux agent you can troubleshoot, manage and manually control the agent by using the scxadmin tool.
/opt/microsoft/scx/bin/tools/scxadmin -stop [all|cimom|provider] /opt/microsoft/scx/bin/tools/scxadmin -start [all|cimom|provider /opt/microsoft/scx/bin/tools/scxadmin -restart [all|cimom|provider]
You can view the running status by executing: /opt/microsoft/scx/bin/tools/scxadmin -status [all|cimom|provider]
And you can view the agent version by executing: /opt/microsoft/scx/bin/tools/scxadmin –version
You can enable debug level logging on all 3 components - wsman, cimom (openPegasus) and the providers. The following command creates the necessary entries in the agent configuration for logging: /opt/microsoft/scx/bin/tools/scxadmin -log-set [all|cimom|provider] {verbose | intermediate | errors}
The following logs are created in /var/opt/microsoft/scx/log:
The initial Linux Logging setting shows this:
As you can see no logging is currently configured.
When we change the logging level to verbose for all components the logging level changes to TraceLevel 4.
Let’s have a look at the log files first to see what’s happening now.
You can see the log file size is growing fast ;-)
Ok, after you have found what you are looking for you want to stop the Linux Agent logging. But how do you stop the Linux Agent Logging?
According to the scxadmin --help you can stop the logging with the next commando: scxadmin –log-reset
Let’s run that command now and check the new settings.
Huh? Even though we did a –log-reset according to the –log-list the traceLevel is still 1.
If we look at the log files for info if there is still logging going on we see that no logging is taking place after the –log-reset. The reason why the –log-list command still shows a tracelevel of 1 is due to explicit config files (/etc/opt/microsoft/scx/conf/cimserver_current.conf). So you can ignore the tracelevel=1 in the –log-list of scxadmin after enabling and resetting logging on a Linux Agent.
Have fun with OpsMgr and Crossplatform monitoring.
Did you remember the Event Creator for MOM 2005 which was available in the Resource Kit? You could use this tool to create events for testing Management Packs. Event Creator enables you to choose event sources for the existing event logs that are currently registered. You can probably use this tool also for testing in your OpsMgr environment but why not use PowerShell?
You have at least installed PowerShell on you Management Server(s) so why not use PowerShell to create events for testing?
With some help from the PowerShell Guy I created a PowerShell script to create events in the eventlog.
Or you can download the PowerShell script from the PowerShell Code Repository.
After posting some years ago a blog post with all the OpsMgr 2007 tools I thought it would be time for a new OM2012 Toolbox blog post.
The previous version 1.7 (that works with OpsMgr 2007 and 2007 R2) was released here. Version 2.1.2 has been updated to work with OpsMgr 2012, and now includes support for MPB files (MP Bundles) as well as the ability to Unseal and Unpack MP Bundles. Warning: only MP Bundles that contain a single ManagementPack are supported; there are some Service Manager MPBs that contain multiple ManagementPacks in a single bundle, and this tool currently cannot deal correctly with those.
This utility allows you to compare Management Packs between your Operations Manager and/or Service Manager environments.
Online catalog check is also available.
Changes in this version:
SCOMTypeView is a tool help MPAuthor visualize ManagementPackClass, ManagementPackRelationship, showing them in treeview. The most important, you can see how the specific MonitoringObject is connected with other MonitoringObject. This tool connect to your local ManagementGroup, showing real data in time.
Coretech XML Connector for SCOM 2012
The Alert Update Connector can modify alert custom fields with additional information useful for situations like controlling alert forwarding to incident management systems and help reduce noise in the incident creation process.
In OpsMgr 2012, we provided users the ability to create customized dashboards using the OpsMgr 2012 console. The GTM.exe tool provided in this blog allows you to build off these dashboard investments, in particular we allow you to accomplish three specific tasks that you cannot do via the console.
1. Turn IT Pro Console created dashboards into shippable MPs by stripping out management group specific parameters (removes MG GUIDs from dashboard MPs)
2. Provides the ability to have a custom dashboard show up under any Management Pack folder in the Monitoring view.
3. Have a custom dashboard be launched from the task pane when you pick a specific computer or object.
Let me please know if I’m missing some other great OM2012 tools.
Thanks to Jeremy Pavleck I found out that Twitterfeed is much more efficient than using a PowerShell rss2twitter script. And he is right!
But I learned some PowerShell creating the rss2twitter script ;-)
We have released CU6 for System Center Operations Manager 2007 R2.
Cumulative Update 6 for Operations Manager 2007 R2 includes all previous cumulative updates for Operations Manager 2007 R2 and includes all cross-platform updates.
To download Cumulative Update 6 for Operations Manager 2007 R2, go to the following Microsoft Download Center website:
Download Cumulative Update 6 for System Center Operations Manager 2007 R2 (http://www.microsoft.com/downloads/details.aspx?FamilyID=694147f8-9691-4833-97af-0de918c60141)
Cumulative Update 6 for Operations Manager 2007 R2 resolves the following issues:
System Center Operations Manager 2007 R2 Cross Platform Monitoring Management Packs (http://www.microsoft.com/downloads/details.aspx?FamilyID=b15fef5c-e331-4006-8913-be376bb0e0c1)
In OpsMgr 2007 we had the option to create a RSS Feed for Alerts using the Operations Web Console.
Selecting the RSS button would return the following RSS Feed info.
In System Center 2012 Operations Manager (OM2012) we don’t have that option anymore. But this is not really an issue, because with a little bit of PowerShell magic, we can create our own OM2012 Alert RSS feed with all the Alert information we want. And that is exactly what I did when I saw an internal question about this feature missing in OM2012.
Environment information:
Pre-requisites:
What is PowerShel PipeWorks?
PowerShell Pipeworks is a Framework for making Sites and Services with Windows PowerShell. Read more about Pipeworks here.
Installation steps for creating an OM2012 Alert RSS feed
1. Download PowerShell PipeWorks Module. 2. Copy Module to Management Server where you have installed:
3. Unblock PipeWorks.1.0.2.6.zip file before extracting (you can also use the PowerShell v3 unblock-file Cmdlet if you have PowerShell v3 installed)
4. Extract the PipeWorks Module to your default PowerShell Module folder. You can check the default folders where PowerShell is looking for PowerShell modules using the following PowerShell command:
I personally have created a D:\PowerShell\Modules folder to store the PipeWorks Module and added that path to my psmodulepath variable. You can add a new Module Path using the following Command in PowerShell:
5. Create an IIS Application Pool for PipeWorks Change the Identity of the Application Pool to use the OM2012 SDK Account (Microsoft System Center Data Access Service account).
6. Add PipeWorks Application
Enter Alias and Select previously created Application Pool. Enter Physical Path where to store the later to be created OM2012 RSS Alert files. Create Folder PipeWorks (C:\inetpub\wwwroot\PipeWorks) if that folder does not exist.
And configure the OM12_SDK Account to connect as configuration.
And finally Test Connection.
7. Use PipeWorks Module to create an OM2012 Alert Web Service, which we can use as an RSS Feed. a. Open PowerShell ISE b. Load PowerShell PipeWorks Module in PowerShell ISE.
c. Create the following Function in the PowerShell ISE:
function Get-MySCOMAlert { <# .Synopsis Shows SCOM Alerts .Description Shows SCOM Alerts for OM2012 .Example Get-MySCOMAlert .Example Get-MySCOMAlert -ResolutionState New .Example Get-MySCOMAlert -ResolutionState Closed #> [CmdletBinding()] param ( [Parameter(Mandatory=$True, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True, HelpMessage='What is the ResolutionState of the Alerts you want to filter on?')] [string[]]$ResolutionState, [int]$First=50 ) process { if(!(Get-Module OperationsManager)) { Import-Module OperationsManager } #To convert string ResolutionStates to integers switch ($ResolutionState) { New {[int]$ResolutionState = 0} Closed {[int]$ResolutionState = 255} default {return "$($ResolutionState) is unknow ResolutionState"} } #end Switch Get-scomalert -ResolutionState $ResolutionState | sort -Property TimeRaised -Descending | select Severity, Priority, Name, TimeRaised -First $First } #end Process }
We can test the Function by selecting the function and hitting F8 Running the following command: Get-MySCOMAlert -ResolutionState "New" -First 2 returns the latest 2 OM2012 Alerts with ResolutionState New.
d. Convert Function to PipeWorks Web Service by running the following PipeWorks Command:
e. Check the Web Service in your Web browser by running the following command from the PowerShell ISE
You should see something like this:
You can now test the Get-MySCOMAlert Web Service by entering a ResolutionState and First (number of Alerts you want to return) Result:
8. Retrieve RSS feed URL. Now we have created the Get-MySCOMAlert Web Service we can add some parameters to retrieve the RSS Feed for the OM12 Alerts.
This will return the RSS Feed for all OM2012 Alerts with a ResolutionState of new and only shows the last 2 new Alerts.
Have fun and let me know some other cool things you have created using PowerShell PipeWorks!!
DISCLAIMER: THIS PROGRAM SOURCE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY REPRESENTATION OR CONDITION OF ANY KIND EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO CONDITIONS OR OTHER TERMS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. THE USER ASSUMES THE ENTIRE RISK AS TO THE ACCURACY AND THE USE OF THIS PROGRAM CODE OR RESULTING EXECUTABLE CODE
Just a short blogpost to let you know we released the Technical Documentation Download for System Center 2012 – Operations Manager. Go to Microsoft Download Center and download the following documentation.
Overview
The downloadable files listed on this page contain the product documentation for the Operations Manager component of System Center 2012. The available downloads include:
And for you lazy people who don’t want to click for each download I again created a PowerShell script to download them all in on go
############################################################################### # Download all OM12 Documents from # http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=29256 # in one-go using PowerShell and BitsTransfer. # Remark: Use PowerShell 2.0 because it makes use of the BitsTransfer Module # Author: Stefan Stranger # v1.002 - 01/04/2012 - stefstr - second release ###############################################################################
$outputfolder = "c:\Temp\OM12Docs"
Import-Module BitsTransfer #Loads the BitsTransfer Module Write-Host "BitsTransfer Module is loaded"
$OM12Docs = @("http://download.microsoft.com/download/3/3/F/33F52373-3A75-422C-969B-61E05EEC5E72/SC2012_OpsMgr_Operations.docx", "http://download.microsoft.com/download/3/3/F/33F52373-3A75-422C-969B-61E05EEC5E72/SC2012_OpsMgr_Authoring.docx", "http://download.microsoft.com/download/3/3/F/33F52373-3A75-422C-969B-61E05EEC5E72/SC2012_OpsMgr_Cmdlets.doc", "http://download.microsoft.com/download/3/3/F/33F52373-3A75-422C-969B-61E05EEC5E72/SC2012_OpsMgr_Deployment.docx") Foreach ($OMDoc in $OM12Docs) { Start-BitsTransfer -source $OMDoc -Destination $outputfolder} Write-Host "OM12 Docs are downloaded to $outputfolder"
Today I deployed some new Management Pack in my OM2012 demo environment, and to check if the Management Packs got deployed I checked the Operations Manager Eventlog for eventid 1201.
And because I do this every time when I deploy new Management Packs I created a PowerShell script to check for these events. This is why we invented PowerShell
I wanted to know which Management Packs where deployed since the last hour. No need to retrieve all deployed Management Packs.
$regex = [regex]'"(.*?)"'
#Custom formatting $format = @{Label="MPName-Version";Expression={$regex.Matches($_.Message)}}
get-eventlog -LogName "Operations Manager" -after (get-date).addhours(-1) | Where-Object {$_.Eventid -eq 1201} | Format-Table TimeGenerated, EventId, $format -AutoSize
You can even add the –computername switch to retrieve remote eventids if you want.