Bonjour tout le monde,

Cela fait 3 jours que je cherche un script qui permet de faire de la copie de Fichier+share+Acl et je vous cache pas ça court pas les rues. La plupart des propositions pour les shares ou je bloque complet vu ma nullité en langage, c'est l'export de la clé de registre "Shares" sauf que je veux pas tout récupérer.

Voila ce que j'ai trouvé comme script :
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
Set objShell = CreateObject("Wscript.Shell")
 
objSource = InputBox("Enter Source")
objDestination = InputBox("Enter Destination")
 
objCommand = "RoboCopy.Exe " & Chr(34) & objSource & Chr(34) & " " & Chr(34) & objDestination & Chr(34) & " /SEC /E /r:1 /w:2"
objShell.Run(objCommand)
 
 
Set objWMIServiceSource = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & objSource & "\root\cimv2" )
 Set ListeDesPartagesSource = objWMIServiceSource.ExecQuery("Select * from Win32_Share" )
 
    Set objWMIServiceDestination = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & objDestination & "\root\cimv2" )
   Set ListeDesPartagesDestination = objWMIServiceDestination.ExecQuery _
   ("Select * from Win32_Share" )
   Set NouveauPartage = objWMIServiceDestination.Get("Win32_Share" )
 
   For each PartageSource in ListeDesPartagesSource
 
       PartageExiste = False
       For each PartageDestination in ListeDesPartagesDestination
           If PartageDestination.Name = PartageSource.Name Then
               PartageExiste = True
               PartageDestination.Path = PartageSource.Path
               PartageDestination.Type = PartageSource.Type
               PartageDestination.MaximumAllowed = PartageSource.MaximumAllowed
               PartageDestination.Caption = PartageSource.Caption
           End If
       Next
 
       If Not PartageExiste Then
           CodeRetour = NouveauPartage.Create(PartageSource.Path, PartageSource.Name, _
           PartageSource.Type, PartageSource.MaximumAllowed, _
           PartageSource.Caption)
       End If
   Next

Cela bloque sur "Set objWMIServiceSource" et je trouve pas de détail sur cette objet (c'est bien sa??)

Alors si il y a une personne qui veut bien m'expliquer pourquoi ça bloque je suis preneur.

Mon script actuel modifie les propriétés d'un compte dans l'onglet Profil et Profil de services Terminal Server et je voudrais le continuer sur la copie des données. Une fois terminé si cela intéresse du monde.

Merci d'avance pour votre aide