IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Outlook : Lister tous les PST montés


Sujet :

VBScript

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 8
    Points : 2
    Points
    2
    Par défaut Outlook : Lister tous les PST montés
    Bonjour,

    Je cherche à faire un petit script permettant de remonter tous les PST d'Outlook après avoir régénéré le profil de l'utilisateur. J'ai réussi à monter un PST dans outlook de cette façon :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNameSpace("MAPI")
     
    myNameSpace.AddStore("C:\xxxxxxxx\Test.pst")
    Je cherche maintenant à lister tous les PST que l'utilisateur a monté dans Outlook (avant de régénérer son profil) et à récupérer le chemin de stockage de ces derniers, pour ensuite lancer une boucle qui me les monte un par un (après avoir régénérer son profil).

    Quelqu'un sait-il comment je peux récupérer ça ?

    Merci d'avance !!

  2. #2
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    Est ce que tu connais, où sais comment récupérer le répertoire où ils sont stockés ?
    Par ce que si c'est le cas, c'est comme lister les fichiers d'un répertoire. Regarde ici :
    http://www.activexperts.com/activmon...esInFolder.htm
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  3. #3
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    Et non le problème c'est qu'ils peuvent être n'importe où. J'ai environ 8 000 utilisateurs... C'est pour ça que je voulais récupérer la liste des chemins à partir des PST montés dans Outlook

  4. #4
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    Sur le liens que je t'ai passé, tu peux rechercher les fichiers sur un pc entier. Et spécifier que tu cherches les *.pst
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  5. #5
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    Ah ok, ben au pire je ferais ça, mais ça risque de prendre pas mal de temps car il faut scanner tout le disque...

  6. #6
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    Essaye, je ne peu l'affirmer, mais je crois que la recherche est plutot rapide.
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  7. #7
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    Ca roule je vais tester. Je vous tiens au courant !

  8. #8
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    Tutoiement autorisé
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  9. #9
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    Non mais c'était pour dire que je tenais tout le monde au courant Le forum quoi

  10. #10
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  11. #11
    Candidat au Club
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2007
    Messages : 8
    Points : 2
    Points
    2
    Par défaut
    "it could take an hour or more to complete, depending on the number of files on the computer. Depending on the number of files and on available memory, this script could fail before finishing"

    => Je vais p'têtre pas faire comme ça alors finalement...

  12. #12
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    lol
    faut dire que je n'ai jamais fait de recherche sur tout le pc alors j'ai pas vu vu la phrase.

    Bon pares moi je n'ai aps piloté outlook dans mes projets, alors je ne peut pas te dire où tu peux trouver les pst.

    bon courage pour la suite
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  13. #13
    Membre averti
    Inscrit en
    Août 2007
    Messages
    302
    Détails du profil
    Informations personnelles :
    Âge : 57

    Informations forums :
    Inscription : Août 2007
    Messages : 302
    Points : 341
    Points
    341
    Par défaut
    Salut,

    il n'y aurait pas une clé de registre qui donne le chemin d'accès aux fichier ?

    Tiens je viens de trouver ca sur le script center : "How Can I Get a List of All the .PST Files on a Computer"

    http://www.microsoft.com/technet/scr...5/hey0408.mspx

    mais c'est méthode bourrin.

    A++
    Plus tu pédales moins vite, moins t'avances plus vite.

  14. #14
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    lol c'est la méthode de recherche de fichier sur un ordinateur.


    Cela risque d'être un peu long en fonction du volume de fichier d'après ce qu'a lu sknonks31 sur le liens que je lui ai fournis.

    Si cela continus il va croire que c'est la seule solution
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  15. #15
    Membre averti
    Inscrit en
    Août 2007
    Messages
    302
    Détails du profil
    Informations personnelles :
    Âge : 57

    Informations forums :
    Inscription : Août 2007
    Messages : 302
    Points : 341
    Points
    341
    Par défaut
    Citation Envoyé par ced600 Voir le message
    Si cela continus il va croire que c'est la seule solution
    en ce qui me concerne je n'ai jamais touché à un outlook (je fais du Domino), c'était juste pour tenter de faire avancer le schmilblik

    A++
    Plus tu pédales moins vite, moins t'avances plus vite.

  16. #16
    Expert confirmé
    Avatar de ced600
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Août 2006
    Messages
    3 364
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Août 2006
    Messages : 3 364
    Points : 4 061
    Points
    4 061
    Par défaut
    c'est mon cas aussi et même réaction.
    De toute façon actuellement il n'y a pas 36 personnes qui répondent sur ce sous forum
    on va attendre une réponse de BBil, le dernier espoir
    Pourquoi faire compliqué lorsque l'on peut faire encore plus compliqué.

  17. #17
    Expert éminent sénior


    Profil pro
    Inscrit en
    Juin 2003
    Messages
    14 008
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 14 008
    Points : 20 038
    Points
    20 038
    Par défaut
    Citation Envoyé par ced600 Voir le message
    lol c t mon cas aussi et même réaction.
    De toute façon actuellement il n'y a pas 36 personnes qui répondent sur ce sous forum
    on va attendre une réponse de BBil, le dernier espoir
    Oui mais la semaine je suis sous Vista et j'ai pas Outlook

    Je déplace temporairement ce message sous le forum Outlook VBA... en espérant que quelqu'un ait la solution la-bas... (même en VBA ..) on reviendra ensuite ici pour transformer le code en VBS..

  18. #18
    Expert éminent
    Avatar de Oliv-
    Homme Profil pro
    solution provider
    Inscrit en
    Mars 2006
    Messages
    4 087
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : solution provider

    Informations forums :
    Inscription : Mars 2006
    Messages : 4 087
    Points : 7 168
    Points
    7 168
    Billets dans le blog
    20
    Par défaut
    SAlut,
    Il y a un utilitaire qui peut faire cela
    http://www.publicshareware.com/outlo...x-profile.html
    et la page indique un lien http://www.outlook-tips.net/howto/ghosts.htm

    Mais j'ai eu un code vba faisant cela entre les mains,
    je vaias chercher!

  19. #19
    Expert éminent
    Avatar de Oliv-
    Homme Profil pro
    solution provider
    Inscrit en
    Mars 2006
    Messages
    4 087
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : solution provider

    Informations forums :
    Inscription : Mars 2006
    Messages : 4 087
    Points : 7 168
    Points
    7 168
    Billets dans le blog
    20
    Par défaut

    J'ai retrouvé :

    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
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    Attribute VB_Name = "where_pst"
    'Option Explicit
     
    '=======================================================================================
    'This vbscript is used to read all the outlook profiles for that user from the registry
    'to check for all types of PSTs (Archive, Personal Folders). It writes to
    'a CSV file the path of the PST, the computer name its on, the username of the
    'person logged on and the size of the PST. It then overwrites the path to the
    'registry depending on the path required. Specially usefull when doing a migration.
    'I am sure there is a much better way to write this code because there is a lot
    'of repetition and i have no more time to do this so i will let you guys do that ;)
    'It should work for outlook versions from 2000 and 2003.
    '
    'By:  Carlos Bueno
    '========================================================================================
     
    Const HKEY_CURRENT_USER = &H80000001
    Const BASE_KEY = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
    Public fso, oNetwork, ws, ws2, objFileSystem
    Public strComputer, tinyKeyPath, strOutputFile, objOutputFile, strInfo, strInfo2, BinOrStr, objreg, arrSubKeys
     
     
    Sub pst_where()
     
     
    'the network object used to connect to the network
    Set oNetwork = CreateObject("WScript.Network")
     
    'two objects to shell script.
    Set ws = CreateObject("WScript.Shell")
    Set ws2 = CreateObject("WScript.Shell")
     
    'object used for later on getting the size of the PSTs
    Set fso = CreateObject("Scripting.FileSystemObject")
    strComputer = "."
     
    'gets username of the person logged on
    strInfo = oNetwork.UserName
     
    'gets the computer name
    strInfo2 = oNetwork.ComputerName
     
    'A list of object required to write to the csv file and a variable that
    'contains the name of the file (partial logged username). This is going
    'to be used to write the data from the registry to the file along with
    'logged on username and computer name.
    strOutputFile = strInfo & "-pstpath.csv"
    Set objFileSystem = CreateObject("Scripting.fileSystemObject")
    Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, True)
     
    'object used to connect to the registry
    Set objreg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
     
    'This enumarates all the different profiles for the user
    objreg.EnumKey HKEY_CURRENT_USER, BASE_KEY, arrSubKeys
     
    'selects each profile
    For Each subkey In arrSubKeys
        subKeyPath = BASE_KEY & "\" & subkey
     
        'This enumerate the subkeys of each profile and exposing
        'the items that contain the data
        objreg.EnumKey HKEY_CURRENT_USER, subKeyPath, arrTinyKeys
     
        'selects each subkey within the profile
        For Each tinyKey In arrTinyKeys
            tinyKeyPath = subKeyPath & "\" & tinyKey
     
                'resets the string to empty. Includes flags
                PSTPath = ""
                PSTPath5 = ""
                PSTPath4 = ""
                PSTPath6 = ""
                myFlag = 0
                BinOrStr = 0
                '--------------------------------------------------------------------------------------
                'Outlook 2000 reading and writting
                '--------------------------------------------------------------------------------------
    '            On Error Resume Next
    '            PSTKeyName4 = "HKCU\" & tinyKeyPath & "\001e6700"
    '            strValue4 = ws.RegRead(PSTKeyName4)
    '            If Err Then
    '            Else
    '                If strValue4 <> 0 Then
    '                    PSTPath4 = PSTPath4 & strValue4
    '                End If
    '
    '
    '                    w = WriteToFilecsv(PSTPath4, PSTKeyName4)
    '
    '
    '                PSTKeyName5 = "HKCU\" & tinyKeyPath & "\01020fff"
    '                strValue5 = ws.RegRead(PSTKeyName5)
    '                For L = LBound(strValue5) To UBound(strValue5)
    '                    If strValue5(L) <> 0 Then
    '                        PSTPath5 = PSTPath5 & Chr(strValue5(L))
    '                    End If
    '                Next
    '
    '                PSTPath5 = Replace(PSTPath5, "8¡»å¡»+*VÂmspst.dllNITAù¿¸ª7Ùn", "")
    '                w = WriteToFilecsv(PSTPath5, PSTKeyName5)
    '            End If
    '            Err.Clear
                '----------------------------------------------------------------------------------------
                'Outlook 2003 reading and writting
                '----------------------------------------------------------------------------------------
                On Error Resume Next
                PSTKeyName = "HKCU\" & tinyKeyPath & "\001f6700"
                strValue = ws.RegRead(PSTKeyName)
                If Err Then
                Else
                    For L = LBound(strValue) To UBound(strValue)
                        If strValue(L) <> 0 Then
                            PSTPath = PSTPath & Chr(strValue(L))
                        End If
                    Next
     
                w = WriteToFilecsv(PSTPath, PSTKeyName)
                    PSTKeyName6 = "HKCU\" & tinyKeyPath & "\01020fff"
                    strValue6 = ws.RegRead(PSTKeyName6)
     
                    For L = LBound(strValue6) To UBound(strValue6)
                        If strValue6(L) <> 0 Then
                            PSTPath6 = PSTPath6 & Chr(strValue6(L))
                        End If
                    Next
     
                    PSTPath6 = Replace(PSTPath6, "8¡»å¡»+*VÂmspst.dllNITAù¿¸ª7Ùn", "")
                    w = WriteToFilecsv(PSTPath6, PSTKeyName6)
     
                End If
                Err.Clear
        Next
    Next
     
    'close and assign to nothing the object used to write to file
    objOutputFile.Close
    Set objFileSystem = Nothing
     
    MsgBox "Finished outlook PST check..."
    End Sub
    '------------------------------------------------------------------------------------------------------
    'The following two functions builds the hex number from a string and creates
    'a binary variable that contains the data in bytes since the data
    'needs to be in byte format in order to be entered onto the the registry.
    'Also it adds back on the start of the string the hex number of the data that
    'was "replaced" earlier just after reading from the registry.
    Public Function StringToByteArray(Data, NeedNullTerminator)
        Dim strAll
        strAll = StringToHex4(Data)
        If NeedNullTerminator Then
            If BinOrStr = 2 Then
            '2000
                strAll = "0000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E000000" & strAll
                strAll = strAll & "00"
            End If
            If BinOrStr = 1 Then
            '2003
                strAll = "0000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E00000000" & strAll
                strAll = strAll & "0000"
            End If
            If BinOrStr = 3 Then
            '2003
                strAll = strAll & "0000"
            End If
        End If
        intLen = Len(strAll) \ 2
        ReDim arr(intLen - 1)
        For i = 1 To Len(strAll) \ 2
            arr(i - 1) = CByte("&H" & Mid(strAll, (2 * i) - 1, 2))
        Next
        BinOrStr = 0
        StringToByteArray = arr
    End Function
     
    'returns the value as a hex number with the 00 added
    Public Function StringToHex4(Data)
        Dim strAll
        For i = 1 To Len(Data)
            strChar = Mid(Data, i, 1)
            If myFlag = 0 Then
                strTemp = Right("00" & Hex(AscW(strChar)), 4)
                strAll = strAll & Right(strTemp, 2) & Left(strTemp, 2)
            Else
                strTemp = Hex(AscW(strChar))
                strAll = strAll & Right(strTemp, 2)
            End If
        Next
        myFlag = 0
        StringToHex4 = strAll
    End Function
     
    '----------------------------------------------------------------------------------------------------------------
    'function to write the data onto a csv file where the path in the registry was changed for the psts
    Public Function WriteToFilecsv(myPath, myPSTKeyName)
        myFsize = FormatNumber(fso.GetFile(myPath).Size, 0, , -1)
        v = Split(tinyKeyPath, "\")
        myProfName = Trim(v(6))
        objOutputFile.WriteLine (strInfo & ";" & strInfo2 & ";" & myPath & ";" & myProfName & ";" & myFsize & ";" & myPSTKeyName)
    End Function

  20. #20
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2013
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2013
    Messages : 16
    Points : 10
    Points
    10
    Par défaut
    Bonjour,

    Je suis également intéressé par cet problématique de remonter de pst via un listing.

    tout mes pst se trouve dans D:\Users\a0001743\Documents\outlook

    et je souhaite les remonter dans mon outlook.

    Le début de sknonks31 est super bien maintenant comme je suis pas un pro j'aimerai bien avoir une solution pour ceci.

    Merci d'avance

Discussions similaires

  1. [Tableaux] Lister tous les attributs d'un annuaire LDAP
    Par bob.marley dans le forum Langage
    Réponses: 1
    Dernier message: 25/08/2006, 18h37
  2. Lister tous les triggers qui sont DISABLE
    Par mpeppler dans le forum Oracle
    Réponses: 2
    Dernier message: 23/08/2006, 10h05
  3. Réponses: 1
    Dernier message: 19/08/2006, 10h27
  4. MFC CDialog - lister tous les composants presents
    Par firejocker dans le forum MFC
    Réponses: 11
    Dernier message: 03/04/2006, 16h10
  5. Comment lister tous les composants d'une fiche ?
    Par tipiweb dans le forum Langage
    Réponses: 2
    Dernier message: 18/01/2006, 21h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo