Tuesday, 20 January 2015

SCOM Agent is not installed but still showing in Pending State in SCOM 2012 r2-Resolved

SCOM Agent is not installed but still showing in Pending State in SCOM 2012 r2-steps to resolve


  • We recently had a issue where there is no SCOM agent on the server.But When we try to Install SCOM agent from Console its says there is already agent pending to be managed and doesn't allow to install.
  • Then when we check the pending agent state it shows up there ,but if i go and check the server there is no SCOM agent.
  • So we where puzzled how its coming in pending management. Then we reject in pending management it goes from there.But if i try to install agent again it comes in pending management.
  • So its stuck in pending management,So this time i rejected it and its gone from there.
  • Then i Ran the Command shell command
               GET-SCOMPendingManagement | where {$_.AgentName -eq "FQDNServername"

  • And the server was showing pending in command shell but not in console.
  • To fix it you need to login to Operations Manager database server and run the below store procedue on query window on the operations manager database
               p_AgentPendingActionDeletebyAgentName 'FQDNServername'

Friday, 16 January 2015

VBSCript to check if file exist and update scom

VBSCript to check if file exist and update scom



Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFile = "C:\MYFILE.LOG"
If objFSO.FileExists(strFile) Then
Call oBag.AddValue("Status", "OK")
Else
Call oBag.AddValue("Status", "Error")
Call oAPI.Return(oBag)
End If

Sunday, 4 January 2015

Powershell Script to put Multiple Computers in Maintenance mode in SCOM 2007 R2

Powershell Script to put Multiple Computers in Maintenance mode in SCOM 2007 R2


You can use the below script to add Mutiple Computer in Maintenance mode in SCOM 2007 R2

$comparr= get-content -file "c:\scomscripts\servert.txt"

$starttime = "12/25/2014 22:00" # Change the Starttime
$EndTime = "12/27/2014 23:00"   # Change the Endtime

foreach($Computer in #comparr)

{
$objComputer =Get-agent | where-object {$_.Name -match $computer

$objComputer.HostComputer | New-MaintenaceWindow -StartTime:$starttime -EndTime:$EndTime -Comment" "Server in MM mode"
}

How to get the RUN window in Windows Server 2012 R2

How to get the RUN window in Windows 2012


  • To get the Run Windows in Current version You just click on Start and search for Run and it will show up.
  • To get the Run windows in Windows 2012. Right Click on the Start Button.It will show the Run Program there.Click on it and you will get the Run Windows

Wednesday, 31 December 2014

SCOM Agent Uninstall error : The patch Package could not be opened

SCOM Agent Uninstall error : The patch Package could not be opened



  • SCOM agent uninstall was always a piece of Cake. Jut right click and select uninstall from console



  • But recently i was migrating from SCOM 2007 to SCOM 2012 and i have to uninstall SCOM 2007 R2 agents.Most went wellBut few failed with error


"The patch Package could not be opened. Verify that the patch package exists and that you can access it.Or contact the application support."


  • First reaction was shocked. Haven't seen this error.I have access and all the msi to uninstall.



  • Later i found out that issue is because of fact that the agent creates a reg entry of while installing with unique patch number.And if this conflicts or if there multiple of them then it will fail.


So to fix It follow the below steps,


  • Click Start
  • In Search type Regedit
  • Click on HKEY_CLASSES_ROOT\Installer\Products\07779052F1B26F94BAD9C107B8
  • Then double click on "Patches"
  • Delete all the Values in it and Close it.
  • Now go and try to uninstall it and it will work fine.

Sunday, 28 December 2014

SCOM 2012 R2 Fatal error 1603 while installing Management Server

SCOM 2012 R2 Fatal error 1603 while installing Management Server


  • I was today trying to install SCOM 2012 R2 on Windows 2008 r2.
  • Everything seems to be going well and Pre requisite passed with flying colors.
  • But while installing Management Server in the middle it failed with Fatal error 1603 and all got rolled back and installation was aborted.It asked me to refer the scom install log while which just gave the error 1603 Fatal error.
  • After investigating some time found that there is 1 pre requisite which Microsoft missed to do.Probably a bug.
  • Microsoft.NET 3.5.1 is mandatory. If this is not install it won't say any errors while you run the pre requsite. But.But in middle install will fail.
  • So before starting the installation of SCOM management Server Go to Add/remove programs and click "add roles" and select "Application Server"    and install.
  • This time the MS installation went through without any errors.

Sunday, 21 December 2014

Show-Eventlog:How to open Event viewer from Powershell

How to open Event viewer from Powershell


  • Manytime you might want to open Eventviewer while working in Powershell.
  • There is a way to directly open the event viewer from Powershell.
  • The Command is Show-Eventlog

  • This will directly open the event viewwer from the Powershell