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