Bonjour,

J'ai une classe de connection WMI en C# sous VS 2008, mais malheureusement j'ai un soucis lors de la tentative de connection et je ne comprend pas bien l'erreur suivante :

System.Runtime.InteropServices.COMException (0x80070776): L'exportateur d'objet spécifié est introuvable. (Exception de HRESULT : 0x80070776)

J'essaye de me connecter sur un Windows server 2003. Je travaille à partir d'un pc avec Vista.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
public override bool Initialize()
{
 
	//Configuration des options
	ConnectionOptions Options = new ConnectionOptions();
   Options.Authentication = System.Management.AuthenticationLevel.PacketPrivacy;
    Options.EnablePrivileges = true;
   Options.Impersonation = System.Management.ImpersonationLevel.Impersonate;
	Options.Username = this.userLog;
	Options.Password = this.userPwd;
 
 
	//Construction du Scope de la machine		
    ManagementScope Scope = new ManagementScope("\\\\172.*****\\root\\cimv2", Options);
 
	//Connection à la machine
	try 
		{
			Scope.Connect();
		}
	catch (ManagementException Handling)
		{
			//Erreur d'autentification
			base.InitializeError("Initializing connection", Handling);
			return false;
		}
	catch (System.Runtime.InteropServices.COMException Handling)
		{
			//Erreur sur le RPC distant
			base.InitializeError("Initializing connection", Handling);
			return false;
		}
	catch (System.UnauthorizedAccessException Handling)
		{
			//Erreur d'autorisations
			base.InitializeError("Initializing connection", Handling);
			return false;
		}
 
	return true;
}
Merci de votre aide !