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
|
'DECLARATION POUR LA REQUETE WMI
'Dim ms As System.Management.ManagementScope
Dim oq As System.Management.ObjectQuery
Dim mos As System.Management.ManagementObjectSearcher
Dim co As New ConnectionOptions
Dim obj As System.Management.ManagementObject
Dim ans As Double
Dim col As New ArrayList
Dim retour_execution
co.Authority = "ntlmdomain:mondomaine"
co.Username = frm_menu.compte.Text
co.Password = frm_menu.mdp.Text
Try
'On cree la connection wmi
Dim ms As New ManagementScope("\\" & poste & "\root\cimv2", co)
Dim classInstance As New ManagementObject(ms, New ManagementPath("CIM_DataFile.Name='" & source & "'"), _
Nothing)
' Obtain [in] parameters for the method
Dim inParams As ManagementBaseObject = _
classInstance.GetMethodParameters("Copy")
' Add the input parameters.
inParams("FileName") = destination
' Execute the method and obtain the return values.
Dim outParams As ManagementBaseObject = _
classInstance.InvokeMethod("Copy", inParams, Nothing)
retour_execution = outParams("ReturnValue")
If retour_execution = 0 Then
log = log & Now & " - Copie terminée " & poste & " avec succès" & vbCrLf
Else
log = log & Now & " - " & Err.Description & vbCrLf
End If
Catch
log = log & Now & " - " & Err.Description & vbCrLf
End Try |
Partager