locked
Repair agent from Powershell. Repair-agent. RRS feed

  • Question

  • Experts,

    I am trying to repair the SCOM agents through PowerShell. I am using the below command:

    Get-SCOMAgent -Name "<servername>" | Repair-SCOMAgent.

    But it doesn't do anything. Checked in 'Pending Management' too.

    Went through the below article and checked for syntax etc. All look good.

    http://technet.microsoft.com/en-us/library/hh918480(v=sc.10).aspx

    Please help.

    Regards,

    Praveen


    Praveen

    Saturday, August 24, 2013 12:37 AM

Answers

  • Fixed this :)

    Get-SCOMAgent -Name "FQDN" | Repair-SCOMAgent -PassThru

    Regards,

    Praveen


    Praveen

    • Marked as answer by Praveen Iyer Wednesday, August 28, 2013 11:12 PM
    Wednesday, August 28, 2013 11:12 PM

All replies

  • That should be just fine provided:

    • -Name provided matches the DisplayName property of the agent
    • You're an admin (presumed)
    • Default MS or GW action account has rights to agent (since you're not passing -Credential

    Something that I find helpful is using -whatif, and -passthru. Whatif is a nice way to make sure your command is valid and you have rights.

    Saturday, August 24, 2013 3:05 AM
  • that PS script worked well, is the default action account a local administrator on the target server?

    for testing, you can run the following script if you would like to force the credentials

    Repair-SCOMAgent -ActionAccount (Get-Credentail) -Agent (Get-SCOMAgent <Servername>)

    Saturday, August 24, 2013 3:08 AM
  • Gives error:

    Repair-SCOMAgent : Cannot validate argument on parameter 'Agent'. The argument is null. Supply a non-null argument and try
    At line:1 char:57
    + Repair-SCOMAgent -ActionAccount (Get-Credential) -Agent (Get-SCOMAgent <servername>
    +                                                         ~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (:) [Repair-SCOMAgent], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.SystemCenter.OperationsManagerV10.Commands.Command

    Need Help.

    Regards,

    Praveen


    Praveen

    • Marked as answer by Praveen Iyer Wednesday, August 28, 2013 11:12 PM
    • Unmarked as answer by Praveen Iyer Wednesday, August 28, 2013 11:12 PM
    Wednesday, August 28, 2013 11:00 PM
  • Fixed this :)

    Get-SCOMAgent -Name "FQDN" | Repair-SCOMAgent -PassThru

    Regards,

    Praveen


    Praveen

    • Marked as answer by Praveen Iyer Wednesday, August 28, 2013 11:12 PM
    Wednesday, August 28, 2013 11:12 PM