Comment faire pour supprimer un Pack d'administration Operations Manager

 

Publication: mars 2016

S'applique à: System Center 2012 R2 Operations Manager, System Center 2012 - Operations Manager, System Center 2012 SP1 - Operations Manager

Un pack d’administration n’est plus nécessaire, vous pouvez le supprimer à l’aide de la console Opérateur. Lorsque vous supprimez un pack d’administration, tous les paramètres et seuils associés sont supprimés à partir de System Center 2012 – Operations Manager. En outre, le fichier .mp ou .xml de ce pack d’administration est supprimé du disque dur du serveur d’administration. Vous pouvez supprimer un pack d’administration uniquement si vous avez supprimé tout d’abord des packs d’administration dépendants.

Pour supprimer un pack d’administration

  1. Ouvrez une session sur l'ordinateur avec un compte qui est membre du rôle Administrateurs Operations Manager.

  2. Dans la console Opérateur, cliquez sur Administration.

  3. Dans Administration, cliquez sur Packs d’administration.

  4. Dans le Packs d’administration volet, avec le bouton droit, le pack d’administration vous souhaitez supprimer, puis cliquez sur Supprimer.

  5. Dans le message indiquant que la suppression du pack d’administration peut affecter l’étendue des rôles d’utilisateur, cliquez sur Oui.

Supprimer par programme un pack d’administration avec dépendances

Lorsqu’un pack d’administration est supprimé de l’interface utilisateur du volet administration, il peut s’avérer très fastidieuse pour suivre de manière récursive vers le bas et supprimer tous les packs d’administration dépendants avant de supprimer le pack d’administration importés à l’origine. Un pack d’administration et toutes ses dépendances, vous pouvez utiliser le script suivant pour la suppression en cascade.

Pour exécuter le script, procédez comme suit :

  1. Ouvrez l’invite de commande Operations Manager en mode administrateur.

  2. Exécutez le script joint à partir du répertoire où vous avez enregistré sur le disque. Exemple :

    • .\RecursiveRemove.ps1 < ID ou le nom du système du Panneau de gestion >

    • .\RecursiveRemove.ps1 Microsoft.SQLServer.2014.Discovery

    Remarque vous pouvez voir l’ID ou le nom du système du Panneau de gestion que vous souhaitez désinstaller en le sélectionnant dans installé des packs d’administration affichage. Puis cliquez sur propriétés dans le volet Actions. Puis copiez le contenu de ID: zone de texte en général onglet.

# The sample scripts are not supported under any Microsoft standard support 
# program or service. The sample scripts are 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 the sample scripts and documentation remains with you. In no
# event shall Microsoft, its authors, or anyone else involved in the creation,
# production, or delivery of the scripts 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 the sample scripts or
# documentation, even if Microsoft has been advised of the possibility of 
# such damages.
# PowerShell script to automagically remove an MP and its dependencies.
# Original Author   :       Christopher Crammond
# Modified By       :       Chandra Bose
# Date Created      :   April 24th, 2012
# Date Modified     :   Januray 18th, 2016
# Version       :       0.0.2

# Needed for SCOM SDK
$ipProperties = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
$rootMS = "{0}.{1}" -f $ipProperties.HostName, $ipProperties.DomainName


#######################################################################
# Helper method that will remove the list of given Management Packs.
function RemoveMPsHelper 
{param($mpList)
  foreach ($mp in $mpList)
  {
    $recursiveListOfManagementPacksToRemove = Get-SCOMManagementPack -Name $mp.Name -Recurse
    if ($recursiveListOfManagementPacksToRemove.Count -gt 1)
    {
        Echo "`r`n"
        Echo "Following dependent management packs has to be deleted before deleting $($mp.Name)..."

        $recursiveListOfManagementPacksToRemove | format-table name
        RemoveMPsHelper $recursiveListOfManagementPacksToRemove
    }
    else
    {
        $mpPresent = Get-ManagementPack -Name $mp.Name
        $Error.Clear()
        if ($mpPresent -eq $null)
        {
            # If the MP wasn’t found, we skip the uninstallation of it.
            Echo "    $mp has already been uninstalled"
        }
        else
        {
            Echo "    * Uninstalling $mp "
            Uninstall-ManagementPack -managementpack $mp
        }
    }
  }
}

#######################################################################
# Remove 'all' of the JEE MPs as well as MPs that are dependent on them.
# The remove is done by finding the base MP (Microsoft.JEE.Library) and finding
# all MPs that depend on it.  This list will be presented to the user prompting
# if the user wants to continue and removing the list of presented MPs
function RemoveMPs
{param($mp)

  $listOfManagementPacksToRemove = Get-SCOMManagementPack -Name $mp -Recurse
  $listOfManagementPacksToRemove | format-table name

  $title = "Uninstall Management Packs"
  $message = "Do you want to uninstall the above $($listOfManagementPacksToRemove.Count) management packs and its dependent management packs"

  $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Uninstall selected Management Packs."
  $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Do not remove Management Packs."
  $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)

  $result = $host.ui.PromptForChoice($title, $message, $options, 0) 

  switch ($result)
  {
        0 {RemoveMPsHelper $listOfManagementPacksToRemove}
        1 {"Exiting without removing any management packs"}
  }
}

#######################################################################
# Begin Script functionality
if ($args.Count -ne 1)
{
  Echo "Improper command line arguments"
  Echo ""
  Echo "Specify a command line argument to either import or export MPs"
  exit 1
}
else
{
  $firstArg = $args[0]

  add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";
  $cwd = get-location
  set-location "OperationsManagerMonitoring::";
  $mgConnection = new-managementGroupConnection -ConnectionString:$rootMS;

  RemoveMPs $firstArg

  set-location $cwd
  remove-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";  
}

Notes

Si d’autres packs d’administration importés dépendent du pack d’administration que vous tentez de supprimer, le Packs d’administration dépendants message d’erreur s’affiche. Vous devez supprimer les packs d’administration dépendants avant de continuer.

Operations Manager supprime le pack d’administration sélectionné.