Ask a questionAsk a question
 

AnswerHow To Do a Script to Remove / Install MOM Agent

  • Thursday, September 24, 2009 3:57 PMCreating a Script to Remove and Install MOM Agent Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I have 200 workstations with a MOM Agent installation being pointed to a server who is no longer a Forefront Management Server.

    What I am trying to do is:
    1 - Add the firewall port exception to allow the server to communicate with the MOM agents
    2 -  Remove the MOM Agent
    3 - Install it again with other parameters (these being X:\InstalationCD\CLIENT\CLIENTSETUP.EXE /MS (our new management server hostname) /CG (our new configuration server hostname)

    I have gone as far as this in a batch script:

    netsh firewall add portopening all 1270 "MOM Communication" -> Opens firewall port 1270 which is used for MOM Communication
    net use q: \\192.168.10.17\E -> Map Network Drive where installation CD is located
    Q:\InstalationCD\CLIENT\CLIENTSETUP.EXE /MS CERBERUS /CG CERBERUS -> Forefront Installation
    net use q: /delete /y -> Delete Mapped Network Drive
    pause -> pauses command prompt to check results of batch script

    However, I get an access denied message unless the user logging in is a local administrator.

    I see 3 possible workarounds for this:

    1 - Check if the user is in the local administrators, add the user in local administrators group if it's not there and then remove it if it added the user.
    2 - Do the above, but with 2 VB Scripts included (one to add the user and one to remove it after), running the batch script in between.
    3 - To do everything above all in a VB Script, it would allow distribution via GPO which would be much more suitable but I'm just looking for a solution now.

    Is there such a script or another possible workaround?

Answers

All Replies

  • Friday, September 25, 2009 7:19 AMNick Gu - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    Thank you for your post.

     

    As far as I know, you may use the following command to achieve your goal.

     

    To uninstall the MOM Agent I run

    MsiExec.exe /x {F692770D-0E27-4D3F-8386-F04C6F434040} /q /norestart /l c:\nomom2005.log

     

    To reinstall the agent I run

    MsiExec.exe /i momagent.msi /norestart /qn /l*v "C:\MOMReinstall.log" CONFIG_GROUP=" group_name" MANAGEMENT_SERVER=" server_name"  REINSTALL=ALL

     

    Meanwhile, you may refer to the following links to get more details.

    http://technet.microsoft.com/zh-cn/library/cc180985(en-us).aspx

    http://blogs.technet.com/fcsnerds/archive/2008/11/12/changing-the-management-group-to-which-an-fcs-client-reports.aspx

     

    Regards,


    Nick Gu - MSFT
  • Monday, September 28, 2009 12:27 PMCreating a Script to Remove and Install MOM Agent Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Thank you very much for your reply Nick.

    Could you please explain those parameters:
    On the uninstall:

    /x
    /q - quiet?
    /l (to create a log in -> "folder path")?

    To reinstall:

    /i -> Install?
    /qn
    /l*v

    Where will the command get the MSIexec? Locally? Or do I have to set up a location on the network?

    Another detail, I want to make the Control Level as FULL.

    So, to reinstall:
    MsiExec.exe /i momagent.msi /norestart /qn /l*v "C:\MOMReinstall.log" CONFIG_GROUP=CERBERUS REINSTALL=ALL MANAGEMENT_SERVER=CERBERUS
    Is this correct?

    EDIT:
    Okay, I tried both commands.
    The uninstall went without a problem, it removed the MOM Agent entirely.
    The reinstall, not so well.

    Should I post the log for troubleshooting?
  • Monday, September 28, 2009 12:43 PMNick Gu - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    Thank you for your update.

     

    I’m sorry for not replying you clearly. As we know, Msiexec provides the means to install, modify, and perform operations on Window Installer from the command line.

     

    To install or configure a product Syntax

    msiexec/i {Package | ProductCode}

    Parameters

    /i

    Installs or configures a product.

    Package

    Specifies the name of the Windows Installer package file.

    ProductCode

    Specifies the globally unique identifier (GUID) of the Windows Installer package.

     

    To uninstall a product Syntax

    msiexec/x {Package | ProductCode}

    Parameters

    /x

    uninstalls a product.

    Package

    Name of the Windows Installer package file.

    ProductCode

    Globally unique identifier (GUID) of the Windows Installer package.

     

    For more information, please refer to the following article:

    http://technet.microsoft.com/en-us/library/cc759262(WS.10).aspx

     

    Regards,

     


    Nick Gu - MSFT
  • Tuesday, September 29, 2009 9:25 AMNick Gu - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    To  reinstall MOM agent, please refer to the following command:

     

    MsiExec.exe /i momagent.msi /norestart /qn /l*v "C:\MOMReinstall.log" CONFIG_GROUP=" group_name" MANAGEMENT_SERVER=" server_name"  REINSTALL=”ALL”

    [note: don’t forget the quotation marks “ALL”  ]

     

    Regards,


    Nick Gu - MSFT
  • Tuesday, September 29, 2009 11:57 AMCreating a Script to Remove and Install MOM Agent Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The link helped a lot, thank you.

    The quotation marks must be in the command as well? I thought they would only be needed if there was a space in the names of the servers or the parameters.

    I tried this on my PC - MsiExec.exe /i momagent.msi /norestart /qn /l*v "C:\MOMReinstall.log" CONFIG_GROUP="CERBERUS" MANAGEMENT_SERVER="CERBERUS" REINSTALL=”ALL”

    The result - http://img15.imageshack.us/img15/1969/screenshotdg.jpg

    Is there something I am doing wrong?
  • Wednesday, September 30, 2009 2:06 AMNick Gu - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    Thank you for your update.

     

    The quotation marks is required. Please correct the command as below to see if it works:

     

    MsiExec.exe /i momagent.msi /norestart /qn /l*v "C:\MOMReinstall.log" CONFIG_GROUP="CERBERUS" MANAGEMENT_SERVER="CERBERUS" AM_CONTROL="Full" REINSTALL=”ALL”

     

    Regards,


    Nick Gu - MSFT
  • Thursday, October 01, 2009 10:58 AMCreating a Script to Remove and Install MOM Agent Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you for your reply Nick,

    I tried it but still to no avail.

    I attempted to run it with the parameter /qf so it would give me an user interface and I got this error (http://img35.imageshack.us/img35/6386/screenshot2ph.jpg)

    Do you know where the msi is located?

    Btw, just some more info to make sure we're doing everything right:
    I'm running Windows Vista Enterprise SP2
    The domain is mixed 2000 - 2003 and all the clients I want to install are Windows XP SP3

    Will the same command work in Vista and XP?
  • Friday, October 02, 2009 7:22 AMNick Gu - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    Before running this command, you should make sure the momagent.msi is on your client computer.

     

    If it is located in C:\Forefront\CLIENT\momagen.msi, you may run the command:

    MsiExec.exe /i C:\Forefront\CLIENT\momagent.msi /norestart /qn /l*v "C:\MOMReinstall.log" CONFIG_GROUP="CERBERUS" MANAGEMENT_SERVER="CERBERUS" AM_CONTROL="Full" REINSTALL=”ALL”

     

    Since you have uninstalled  the old MOM agent, I recommend you deploy it with FCS policy.

     

    This is all detailed in the deployment documentation here:  

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

     

    Regards,


    Nick Gu - MSFT
  • Friday, October 02, 2009 1:34 PMCreating a Script to Remove and Install MOM Agent Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Nick, I have managed to find a solution for installing the agents with MOM Console (I created GPOs to create exceptions for the ports that need to be opened for remote instalation).

    However, the unninstall doesn't work unless the user on which I run the logon script (command line) is a member of the local administrators group, which brings me back to my original problem.

    How can I run the unninstall with a user that does not have local admin rights if I don't want the user to remain on that group unless he(she) already was a member?
  • Tuesday, October 06, 2009 2:56 AMNick Gu - MSFTMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi,

     

    Yes, to running MISEXE command, you should have local admin rights. If not, you can manually remove the agent or use momlean.exe utility.

     

    How to Manually Remove an Agent from an Agent Computer

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

     

    Momclean.exe utility

    http://technet.microsoft.com/en-us/opsmgr/bb498240.aspx

     

    Regards,


    Nick Gu - MSFT