flopad
Messages postés528Date d'inscriptionmercredi 28 septembre 2005StatutMembreDernière intervention 6 mars 2009
-
5 juil. 2006 à 09:04
cs_Joe28
Messages postés1Date d'inscriptionmercredi 17 septembre 2003StatutMembreDernière intervention20 janvier 2009
-
20 janv. 2009 à 16:59
Bonjour,
Je suis en train de faire un prog qui me liste les processus lancés sur une machine distante;
Voici un extrait de mon code ; mon prog bloque à la ligne en rouge en me donnat comme message L'exception System.UnauthorizedAccessException n'a pas été gérée
Message="Accès refusé. (Exception de HRESULT : 0x80070005 (E_ACCESSDENIED))"
:
Dim myConnectionOptions
AsNew System.Management.ConnectionOptionsmyConnectionOptions.EnablePrivileges TruemyConnectionOptions.Username "administrateur"myConnectionOptions.Password "XXXX"myConnectionOptions.Impersonation 3
Dim myManagementScope
As System.Management.ManagementScope
' myManagementScope = New System.Management.ManagementScope("\" & _
cesar1984
Messages postés2Date d'inscriptionmercredi 20 juin 2007StatutMembreDernière intervention31 juillet 2007 25 juil. 2007 à 11:43
J'ai exactement le meme pb que toi...j'ai pas trouvé de solution satisfaisante pour l'instant...en configurant un canal ipc$ entre les 2 machines ca fonctionne mais c pas top...voili voilou si quelqu'un a une solution je suis preneur... merci
cesar1984
Messages postés2Date d'inscriptionmercredi 20 juin 2007StatutMembreDernière intervention31 juillet 2007 31 juil. 2007 à 10:04
Bon apparement ce post n'interesse pas grand monde...mais si ca peu servir a quelqu'un....
J'ai reglé mon probleme en modifiant le parametre de securité locaux sur la machine sur laquelle je me connecte...
Outils d'administration=>Stragegie de securité locale=> Strategie locale => option de securité=>Accés reseau: model de partage et de securité pour les compte locaux : Classique- les utilistateur s'authentifie eux meme
voila et en plus ca fonctionne....++
cs_Joe28
Messages postés1Date d'inscriptionmercredi 17 septembre 2003StatutMembreDernière intervention20 janvier 2009 20 janv. 2009 à 16:59
Public Function CheckProcess(ByVal sProcessName As String) As String
Dim oConnectionOptions As New System.Management.ConnectionOptions
oConnectionOptions.Username = "domaine\user"
oConnectionOptions.Password = "xxxx"
oConnectionOptions.Impersonation = ImpersonationLevel.Impersonate
Dim oManagementPath As System.Management.ManagementPath = Nothing
Dim oManagementScope As System.Management.ManagementScope = Nothing
Dim oSearcher As System.Management.ManagementObjectSearcher = Nothing
Dim oCollection As System.Management.ManagementObjectCollection = Nothing
Dim oObject As System.Management.ManagementObject = Nothing
Try
oManagementPath = New System.Management.ManagementPath("[file://\\ServerName"\root\cimv2 \\ServerName"\root\cimv2]")
oManagementScope = New System.Management.ManagementScope(oManagementPath, oConnectionOptions)
oManagementScope.Connect()
If oManagementScope.IsConnected = False Then
Return "Erreur :: Could not connect to WMI "
Exit Function
End If
Dim oQuery As New System.Management.ObjectQuery("Select * From Win32_Process where Name = '" & sProcessName & "'")
oSearcher = New System.Management.ManagementObjectSearcher(oManagementScope, oQuery)
'* execute query
oCollection = oSearcher.Get()
For Each oObject In oCollection
If oObject.GetPropertyValue("Name") = sProcessName Then
'...
End If
Next
Catch ex As Exception
Return ex.Message
Finally
If Not oManagementPath Is Nothing Then
oManagementPath = Nothing
End If
If Not oManagementScope Is Nothing Then
oManagementScope = Nothing
End If
If Not oSearcher Is Nothing Then
oSearcher = Nothing
End If
If Not oCollection Is Nothing Then
oCollection = Nothing
End If
If Not oObject Is Nothing Then
oObject = Nothing
End If