Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3156 connectés 

  FORUM HardWare.fr
  Systèmes & Réseaux Pro
  Stockage

  [RESOLU] Robocopy je suis un NOOB ou pas

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[RESOLU] Robocopy je suis un NOOB ou pas

n°78007
franck3119​5
je ne suis pas google !
Posté le 02-03-2011 à 13:37:35  profilanswer
 

Salut,
je suis en train de faire un script avec robocopy pour faire la sauvegarde de fichiers pst sur les postes.
Ce script sera lancé par GPO à la fermeture de session.
Voici la ligne du script

Code :
  1. robocopy "%userprofile%\documents\fichiers outlook\"  "\\srv-pedussaut\bureautique\%username%\fichiers outlook\" /e /z


Quand je le lance en local, il me met ça comme erreur.
 
 
C:\Users\nathalieb>robocopy "%userprofile%\documents\fichiers outlook\"  "k:\%username%\fichiers outlook\" /e /z
 
-------------------------------------------------------------------------------
   ROBOCOPY   ::   Copie de fichiers robuste pour Windows
-------------------------------------------------------------------------------
 
  Début : Wed Mar 02 13:33:33 2011
 
   Source : C:\Users\nathalieb\documents\fichiers outlook"  k:\NathalieB\fichiers\
     Dest : C:\Users\nathalieb\outlook"\
 
    Fichiers : *.*
 
  Options : *.* /S /E /COPY:DAT /Z /R:1000000 /W:30
 
-------------------------------------------------------------------------------
 
2011/03/02 13:33:33 ERREUR 123 (0x0000007B) Accès au répertoire source C:\Users\nathalieb\documents\fichiers outlook"  k:\NathalieB\fichiers\
La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.
 
Je dois loupé un truc mais j'ai beau lire plusieurs articles sur le net mais je ne vois pas où est mon erreur.
Merci de votre aide.
A+


Message édité par franck31195 le 04-03-2011 à 16:51:20

---------------
Hommage au sergent Aurélie Salel - http://www.pompiersparis.fr/
mood
Publicité
Posté le 02-03-2011 à 13:37:35  profilanswer
 

n°78009
Bocal83
Posté le 02-03-2011 à 13:47:43  profilanswer
 

Salut,
J'suis pas spécialiste de ROBOCOPY mais il ne manque pas un " au début dans ton répertoire source ?

 

Sinon moi j'avais ce script pour aller rechercher automatiquement le ou les .pst présents sur la machines (via registre) et les copier dans un répertoire partagé tout en fermant Outlook et en le rouvrant par la suite :

 
Citation :

Option Explicit
 Const HKEY_CURRENT_USER = &H80000001
 Const r_PSTGuidLocation = "01023d00"
 Const r_MasterConfig = "01023d0e"
 Const r_PSTCheckFile = "00033009"
 Const r_PSTFile = "001f6700"
 Const r_keyMaster = "9207f3e0a3b11019908b08002b2a56c2"
 Const r_ProfilesRoot = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
 Const r_DefaultProfileString = "DefaultProfile"
 Dim oReg        :Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv" )
 Dim arrSubKeys, subkey, strValue, i, pstFile, arrPSTs, DefaultProfileName
 
 oReg.GetStringValue HKEY_CURRENT_USER,r_ProfilesRoot,r_DefaultProfileString,DefaultProfileName
 GetPSTsForProfile(DefaultProfileName)
   
 '_____________________________________________________________________________________________________________________________
 Function GetPSTsForProfile(p_profileName)
    Dim strHexNumber, strPSTGuid, strFoundPST
   
    Dim fso
    Dim Source
    Dim Destination
    Dim oNetwork
    Dim sUserName
 Dim sComputerName
 Dim strDirectory
 Dim strUNC
 Dim ObjFolder
 
'Variables pour lancement automatique d'Outlook
 Dim oShell
 Set oShell = WScript.CreateObject ("WScript.Shell" )

 

WScript.Echo "Attention, Outlook va être fermé. Merci de sauvegarder vos travaux puis cliquez sur OK pour continuer."
 
'Variables pour arrêt du processus "OUTLOOK.EXE"
 Dim objWMIService, objProcess, colProcess
 Dim strComputer, strProcessKill, objWMI, sQuery
 strComputer = "."
 strProcessKill = "'OUTLOOK.EXE'"

 

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" _
 & strComputer & "\root\cimv2" )

 

Set colProcess = objWMIService.ExecQuery _
 ("Select * from Win32_Process Where Name = " & strProcessKill )
 For Each objProcess in colProcess
 objProcess.Terminate()
 Next

 

  Set fso = CreateObject("Scripting.FileSystemObject" )
   Set oNetwork = CreateObject("Wscript.network" )
   
   
   sUserName = oNetwork.UserName
  sComputerName = oNetwork.ComputerName
  strUNC = "\\serveur\share"
  strDirectory = strUNC & "\" & sUserName & "_" & sComputerName
  Wscript.Echo "Nom du répertoire généré : " & strDirectory

 

 Wscript.Echo "Veuillez patienter... Merci de ne pas ouvrir Outlook jusqu'au prochain message"

 

 Set objFolder = fso.CreateFolder(strDirectory)

 

    oReg.GetBinaryValue HKEY_CURRENT_USER,r_ProfilesRoot & "\" & p_profileName & "\" & r_keyMaster,r_MasterConfig,strValue
     For Each i In strValue
         If Len(Hex(i)) = 1 Then  
             strHexNumber = CInt("0" ) & Hex(i)
         Else
             strHexNumber = Hex(i)
         End If
                 
         strPSTGuid = strPSTGuid + strHexNumber
         If Len(strPSTGuid) = 32 Then  
             If IsAPST(r_ProfilesRoot & "\" & p_profileName & "\" & strPSTGuid) Then
                 Wscript.Echo "Fichier(s) .pst trouvé(s) : " & PSTFileName(r_ProfilesRoot & "\" & p_profileName & "\" & PSTlocation(r_ProfilesRoot & "\" & p_profileName & "\" & strPSTGuid))
                 Source = PSTFileName(r_ProfilesRoot & "\" & p_profileName & "\" & PSTlocation(r_ProfilesRoot & "\" & p_profileName & "\" & strPSTGuid))
                 Destination = strDirectory & "\"
                 fso.CopyFile Source, Destination,TRUE

 

            End If
     
         strPSTGuid = ""
         End If            
     Next

 

  Wscript.Echo "La procédure est terminée, Outlook va se relancer"

 

'Lancement processus "OUTLOOK.EXE"  
 oShell.Run "outlook"
 
 End Function
 '_____________________________________________________________________________________________________________________________
 Function IsAPST(p_PSTGuid)
     Dim x, P_PSTGuildValue
     Dim P_PSTCheck:P_PSTCheck=0
     IsAPST=False
     oReg.GetBinaryValue HKEY_CURRENT_USER,p_PSTGuid,r_PSTCheckFile,P_PSTGuildValue
         For Each x in P_PSTGuildValue
             P_PSTCheck = P_PSTCheck + Hex(x)
         Next    
         If P_PSTCheck=20 Then
             IsAPST=True
         End If    
 End Function  
 '_____________________________________________________________________________________________________________________________
 Function PSTlocation(p_PSTGuid)
     Dim y, P_PSTGuildValue
     oReg.GetBinaryValue HKEY_CURRENT_USER,p_PSTGuid,r_PSTGuidLocation,P_PSTGuildValue
        For Each y In P_PSTGuildValue
            If Len(Hex(y)) = 1 Then
                PSTlocation = PSTlocation & CInt("0" ) & Hex(y)
            Else
                PSTlocation = PSTlocation & Hex(y)
            End If    
        Next    
 End Function  
 '_____________________________________________________________________________________________________________________________
 Function PSTFileName(p_PSTGuid)
     Dim z, P_PSTName
     Dim strString : strString = ""
     oReg.GetBinaryValue HKEY_CURRENT_USER,p_PSTGuid,r_PSTFile,P_PSTName
         For Each z in P_PSTName
             If z > 0 Then strString = strString & Chr(z)
         Next    
     PSTFileName = strString
 End Function  
 '_________________________________________________________________________________________________________
 Function ExpandEvnVariable(ExpandThis)
     Dim objWSHShell    :Set objWSHShell = CreateObject("WScript.Shell" )
     ExpandEvnVariable = objWSHShell.ExpandEnvironmentStrings("%" & ExpandThis & "%" )
 End Function
 '_________________________________________________________________________________________________________


Message édité par Bocal83 le 02-03-2011 à 13:49:42
n°78013
franck3119​5
je ne suis pas google !
Posté le 02-03-2011 à 14:37:03  profilanswer
 

Salut,
non il y a bien les guillemets devant et derrière, mais il ne les interprète pas.
Merci pour ton script, je faire des essais.
A+


---------------
Hommage au sergent Aurélie Salel - http://www.pompiersparis.fr/
n°78021
franck3119​5
je ne suis pas google !
Posté le 02-03-2011 à 16:17:03  profilanswer
 

Salut,
je pense avoir trouvé la solution.
au lieu de tapez ça

Code :
  1. robocopy "%userprofile%\documents\fichiers outlook\"  "\\srv-pedussaut\bureautique\%username%\fichiers outlook\" /e /z


 
Il faut taper cela

Code :
  1. robocopy "%userprofile%\documents\fichiers outlook\\"  "\\srv-pedussaut\bureautique\%username%\fichiers outlook\\" /e /z


 
Je teste demain.
A+
 
 
 


---------------
Hommage au sergent Aurélie Salel - http://www.pompiersparis.fr/
n°78081
Xspawn_Lpc
Posté le 03-03-2011 à 20:43:09  profilanswer
 

Et cela ?  
 
robocopy "%userprofile%\documents\fichiers outlook"  "\\srv-pedussaut\bureautique\%username%\fichiers outlook" /e /z /r:1 /w:1
 
il vaut mieux toujours rajouter  /r:1 /w:1 aussi surtout en cas de connexion réseau lente.


---------------
Quand on aime on ne compte pas. Quel Dilemme lorsque l'on aime compter !
n°78121
CK Ze CaRi​BoO
Posté le 04-03-2011 à 16:24:28  profilanswer
 

Il faut que tu retires le "\" à la fin de tes chemins.


---------------
The only thing necessary for the triumph of evil is for good people to do nothing.
n°78123
franck3119​5
je ne suis pas google !
Posté le 04-03-2011 à 16:30:25  profilanswer
 

Salut,
donc petit retour.
robocopy "%userprofile%\documents\fichiers outlook"  "\\srv-pedussaut\bureautique\%username%\fichiers outlook" /e /z /r:1 /w:1
Cela fonctionne bien
 
robocopy "%userprofile%\documents\fichiers outlook\\"  "\\srv-pedussaut\bureautique\%username%\fichiers outlook\\" /e /z
Et ça aussi.
 
Conclusion soit faut pas mettre l'antislash soit faut en mettre deux.
Merci à tous pour votre aide.
 


---------------
Hommage au sergent Aurélie Salel - http://www.pompiersparis.fr/

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Systèmes & Réseaux Pro
  Stockage

  [RESOLU] Robocopy je suis un NOOB ou pas

 

Sujets relatifs
Problème de copie de fichiers avec robocopy dans un domaineRobocopy sans écrasement.
Copier 700 Go avec Robocopy et droits NTFS (urgent) 
Plus de sujets relatifs à : [RESOLU] Robocopy je suis un NOOB ou pas


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)