Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Verwenden Sie zum Definieren des Installationsprogramms für die Bereitstellungstechnologie für die Anwendungsverwaltung eine Instanz der Microsoft.ConfigurationManagement.ApplicationManagement.Installer
-Klasse. Die neue Klasseninstanz definiert die Eigenschaften und Methoden, die auf dem Client verwendet werden, um die Anwendung tatsächlich zu installieren.
Die Installer-Klasse verfügt über drei abstrakte Methoden (CreateDetectionAction, CreateInstallAction, CreateUninstallAction), mit denen der Installer die Action-Objekte angeben kann, die auf dem Client für die Erkennung, Installation und Deinstallation verwendet werden.
Die entsprechende clientseitige Implementierung ist erforderlich, damit der End-to-End-Installer ordnungsgemäß funktioniert. Die clientseitige Implementierung wird unter Definieren des clientseitigen Handlers behandelt.
Im RDP-Beispielprojekt (Remotedesktopprotokoll) ist ein neues Installationsprogramm für das Remotedesktopprotokoll (RDP) erforderlich. Die Installationsunterstützung für RDP ist nicht in Configuration Manager integriert, sodass ein benutzerdefiniertes Installationsprogramm erforderlich ist.
Grundlegende Übersicht über das Definieren eines benutzerdefinierten Installers
Erstellen Sie eine benutzerdefinierte Instanz der
Microsoft.ConfigurationManagement.ApplicationManagement.Installer
-Klasse.Überschreiben Sie die Technology-Eigenschaft, und geben Sie die technologiespezifische TechnologyId-Zeichenfolge zurück.
Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.CreateDetectAction
-Methode, und erstellen Sie eine benutzerdefinierte Erkennungsmethode, die für die Technologie spezifisch ist.Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.CreateInstallAction
-Methode, und erstellen Sie eine benutzerdefinierte Installationsmethode, die für die Technologie spezifisch ist.Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.CreateUninstallAction
-Methode, und erstellen Sie eine benutzerdefinierte Deinstallationsmethode, die für die Technologie spezifisch ist.Erstellen Sie die allgemeinen Eigenschaften, die zum Installieren der benutzerdefinierten Technologie auf dem Client erforderlich sind.
So definieren Sie ein benutzerdefiniertes Installationsprogramm
Erstellen Sie mithilfe des Konstruktors eine Instanz der
Microsoft.ConfigurationManagement.ApplicationManagement.Installer
-KlasseMicrosoft.ConfigurationManagement.ApplicationManagement.Installer
.Im folgenden Beispiel aus dem RDP-Beispielprojekt wird veranschaulicht, wie die benutzerdefinierte Klasse erstellt wird.
// Installer class for a specific technology. The Installer class defines properties and methods used on the client to actually install the application. public class RdpInstaller : Installer
Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.Technology
-Eigenschaft, um den richtigen Wert für die benutzerdefinierte Installationsprogrammtechnologie zurückzugeben.Im folgenden Beispiel aus dem RDP-Beispielprojekt wird veranschaulicht, wie die Technology-Eigenschaft überschrieben wird.
// RDP Installer Technology string public override string Technology { get { return Common.TechnologyId; } }
Im RDP-Beispielprojekt wird der Zeichenfolgenparameter für InstallerTechnologyId als Konstante in der Common-Klasse des Projekts definiert.
// Internal ID of the technology. public const string TechnologyId = "Rdp";
Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.CreateDetectAction
-Methode, und erstellen Sie eine benutzerdefinierte Aktion, die für die benutzerdefinierte Technologie spezifisch ist.Im folgenden Beispiel aus dem RDP-Beispielprojekt wird veranschaulicht, wie die CreateDetectAction-Methode überschrieben wird.
// Creates an Action used for detection. On the client, this sequence is used to validate if the application is installed. public override Action CreateDetectAction() { Action detectionAction = new Action { Provider = Common.TechnologyId }; detectionAction.Arguments.Add(new Argument("Filename", typeof(string), this.Filename)); detectionAction.Arguments.Add(new Argument("InstallFolder", typeof(string), this.InstallFolder)); detectionAction.Arguments.Add(new Argument("FullAddress", typeof(string), this.FullAddress)); detectionAction.Arguments.Add(new Argument("RemoteApplication", typeof(string), this.RemoteApplication)); detectionAction.Arguments.Add(new Argument("RemoteApplicationMode", typeof(bool), false)); return detectionAction; }
Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.CreateInstallAction
-Methode, und erstellen Sie eine benutzerdefinierte Aktion, die für die benutzerdefinierte Technologie spezifisch ist.Im folgenden Beispiel aus dem RDP-Beispielprojekt wird veranschaulicht, wie die CreateInstallAction-Methode überschrieben wird.
// Creates an Action used for installation. On the client, this sequence defines the properties needed to install the application. public override Action CreateInstallAction() { Action installationAction = new Action { Provider = Common.TechnologyId }; installationAction.Arguments.Add(new Argument("Filename", typeof(string), this.Filename)); installationAction.Arguments.Add(new Argument("InstallFolder", typeof(string), this.InstallFolder)); installationAction.Arguments.Add(new Argument("FullScreen", typeof(int), (true == this.fullScreen) ? 1 : 0)); installationAction.Arguments.Add(new Argument("DesktopWidth", typeof(int), this.desktopWidth)); installationAction.Arguments.Add(new Argument("DesktopHeight", typeof(int), this.desktopHeight)); installationAction.Arguments.Add(new Argument("AudioMode", typeof(int), (int)this.AudioMode)); installationAction.Arguments.Add(new Argument("FullAddress", typeof(string), this.FullAddress)); installationAction.Arguments.Add(new Argument("RemoteServerName", typeof(string), this.RemoteServerName)); installationAction.Arguments.Add(new Argument("RemoteServerPort", typeof(int), this.RemoteServerPort)); installationAction.Arguments.Add(new Argument("RemoteApplication", typeof(string), this.RemoteApplication)); installationAction.Arguments.Add(new Argument("RemoteApplicationMode", typeof(bool), false)); installationAction.Arguments.Add(new Argument("ConstructRdpOnClient", typeof(bool), this.ConstructRdpOnClient)); installationAction.Arguments.Add(new Argument("KeyboardMode", typeof(int), (int)this.KeyboardMode)); installationAction.Arguments.Add(new Argument("RedirectPrinters", typeof(int), (true == this.RedirectPrinters) ? 1 : 0)); installationAction.Arguments.Add(new Argument("RedirectSmartCards", typeof(int), (true == this.RedirectSmartCards) ? 1 : 0)); installationAction.Arguments.Add(new Argument("Username", typeof(string), this.Username)); // Adds any references to content to the action. if (this.ConstructRdpOnClient == false && this.Contents.Count > 0) { foreach (Content content in this.Contents) { installationAction.Contents.Add(new ContentRef(content)); } } return installationAction; }
Überschreiben Sie die
Microsoft.ConfigurationManagement.ApplicationManagement.Installer.CreateUninstallAction
-Methode, und erstellen Sie eine benutzerdefinierte Aktion, die für die benutzerdefinierte Technologie spezifisch ist.Im folgenden Beispiel aus dem RDP-Beispielprojekt wird veranschaulicht, wie die CreateUninstallAction-Methode überschrieben wird.
public override Action CreateUninstallAction() { Action uninstallAction = new Action { Provider = Common.TechnologyId }; uninstallAction.Arguments.Add(new Argument("Filename", typeof(string), this.Filename)); uninstallAction.Arguments.Add(new Argument("InstallFolder", typeof(string), this.InstallFolder)); return uninstallAction; }
Erstellen Sie zusätzliche Eigenschaften und Methoden, die auf dem Client zum Installieren der benutzerdefinierten Technologie verwendet werden.
Im folgenden Beispiel aus dem RDP-Beispielprojekt wird die Erstellung von Eigenschaften und Methoden veranschaulicht, die auf dem Client zum Installieren der RDP-Anwendung verwendet werden.
// Default height for the RDP window. public const int DefaultDesktopHeight = 768; // Default width for the RDP window public const int DefaultDesktopWidth = 1024; // Default storage location for RDP files created using this Installer public const string DefaultInstallFolder = @"%USERPROFILE%\Desktop\Remote Desktop Connections"; private RdpAudioMode audioMode; private bool constructRdpOnClient;private int desktopHeight; private int desktopWidth; private bool fullScreen; private string installFolder; private RdpKeyboardMode keyboardMode; private string filename; private bool redirectPrinters; private bool redirectSmartCards; private string remoteApplication; private string fullAddress; private string remoteServerName; private ushort remoteServerPort; private string username; // Audio mode for the RDP connection. The default is BringToComputer. public RdpAudioMode AudioMode { get { return audioMode; } set { SetProp("AudioMode", ref audioMode, value); } } // If true, the RDP file will be constructed locally on the client. If false, the RDP file will live on the server and will be downloaded as content. [Mandatory] public bool ConstructRdpOnClient { get { return constructRdpOnClient; } set { SetProp("ConstructRdpOnClient", ref constructRdpOnClient, value); } } // Height of the remote desktop window. This setting is ignored if FullScreen = true. [Default(DefaultDesktopHeight)] public int DesktopHeight { get { return desktopHeight; } set { SetProp("DesktopHeight", ref desktopHeight, value); } } // Width of the remote desktop window. This setting is ignored if FullScreen = true. [Default(DefaultDesktopWidth)] public int DesktopWidth { get { return desktopWidth; } set { SetProp("DesktopWidth", ref desktopWidth, value); } } // If true, full screen window will be used. public bool FullScreen { get { return fullScreen; } set { SetProp("FullScreen", ref fullScreen, value); } } // Directory on the client where the RDP file will be stored. This is part of Detection. [Mandatory][Default(DefaultInstallFolder)] public string InstallFolder { get { return installFolder; } set { SetProp("InstallFolder", ref installFolder, value); } } // Keyboard mode to use for the RDP session. Default is <see cref = "RdpKeyboardMode.FullScreenOnly" /> [Default(RdpKeyboardMode.FullScreenOnly)] public RdpKeyboardMode KeyboardMode { get { return keyboardMode; } set { SetProp("KeyboardMode", ref keyboardMode, value); } } // Name of the RDP profile. This is part of Detection. [Mandatory]public string Filename { get { return filename; } set { SetProp("Filename", ref filename, value); } } // If true, local printers will be redirected to the remote computer. Default is true. [Default(true)]public bool RedirectPrinters { get { return redirectPrinters; } set { SetProp("RedirectPrinters", ref redirectPrinters, value); } } // If true, local smart cards will be redirected to the remote computer. Default is true. [Default(true)] public bool RedirectSmartCards { get { return redirectSmartCards; } set { SetProp("RedirectSmartCards", ref redirectSmartCards, value); } } // Remote application to run. Setting to %WINDIR%\system32\notepad.exe for example will remote only the notepad.exe application. If unspecified, remote shell will be used. Default is unspecified. public string RemoteApplication { get { return remoteApplication; } set { SetProp("RemoteApplication", ref remoteApplication, value); } } // Remote server name for the RDP connection. [MaxLength(254)] public string RemoteServerName { get { return remoteServerName; } set { SetProp("RemoteServerName", ref remoteServerName, value); } } // Remote server port for the RDP connection. Default is 3389. public string FullAddress { get { return fullAddress; } set { SetProp("FullAddress", ref fullAddress, value); } } // Remote server port for the RDP connection. Default is 3389. [Default((ushort)3389)][Range(Min = (ushort)1, Max = (ushort)65534)] public ushort RemoteServerPort { get { return remoteServerPort; } set { SetProp("RemoteServerPort", ref remoteServerPort, value); } } // RDP Installer Technology string public override string Technology { get { return Common.TechnologyId; } } // Username to use for the remote desktop connection. public string Username { get { return username; } set { SetProp("Username", ref username, value); } }
Namespaces
Microsoft. ConfigurationManagement.ApplicationManagement
Microsoft. ConfigurationManagement.ApplicationManagement.Serialization
Assemblys
Microsoft.ConfigurationManagement.ApplicationManagement.dll