Google
Search WWW Search msexchangetips.blogspot.com

Friday, September 15, 2006

Exchange: Search Network For PST Files

Summary:

In this article, I will provide a script to search your network for .PST files. Microsoft provides a script to search your local computer for a .PST file which you can find here.

http://www.microsoft.com/technet/scriptcenter/resources
/qanda/apr05/hey0408.mspx

I have modified it to also include the computer name since it will be intended to search multiple computers and to write the output to a csv file.

Copy the contents below and save to notepad. Rename this file to searchpst.vbs and save to C: drive.


strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _

("Select * from CIM_DataFile Where Extension = 'pst'")

Set fso = CreateObject("Scripting.FileSystemObject")

set wfile = fso.opentextfile("c:\test.csv",2,true)

For Each objFile in colFiles

Wfile.writeline(strComputer & " " & objFile.Drive & " " & objFile.Path & " " & objFile.FileName & "." & objFile.Extension & " " & objFile.FileSize)

Next




Open your command prompt. Start, Run, CMD Ok. Ensure that you are at your your C:\>

Type the following

C:\>cscript searchpst.vbs

Once complete, go to your C: drive and locate text.csv. This csv file should include your computername, drive letter and path of your pst file, name of pst file and size.



Now if you wish to run this on multiple computers on the network you have couple options.

C:\>cscript searchpst.vbs computer1 computer2 computer3


Another option is to have this script read in the computer names from your computers OU in AD.

Copy the contents below to notepad. Save the file as searchpst1.vbs. Open your command prompt and type:

C:\>cscript searchpst1.vbs

Set colComputers = GetObject("LDAP://CN=Computers, DC=msexchange911, DC=net")
For Each objComputer in colComputers
strComputer = objComputer.CN
on error Resume next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'pst'")
Set fso = CreateObject("Scripting.FileSystemObject")
set wfile = fso.opentextfile("c:\test.csv",2,true)
For Each objFile in colFiles
Wfile.writeline(strComputer & " " & objFile.Drive & " " & objFile.Path & " " & objFile.FileName & "." & objFile.Extension & " " & objFile.FileSize)
next
next


References:

Running WMI Scripts on Multiple Computers
http://www.microsoft.com/technet/scriptcenter/resources
/tales/sg1102.mspx

How Do I Get a List of All PST Files on a Computer
http://www.microsoft.com/technet/scriptcenter/resources
/qanda/apr05/hey0408.mspx


James Chong
MCSE | M+, S+, MCTS, Security+
msexchangetips.blogspot.com

How useful was this article? Want to see a tip not listed? Please leave a comment.

40 Comments:

Anonymous Anonymous said...

Hi When I ran the first script I got the following error, can you help me out..?

C:\>cscript Searchpst.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\Searchpst.vbs(6, 1) Microsoft VBScript compilation error: Expected statement

Thanks
Abhishek

4:44 AM  
Anonymous Anonymous said...

thanks, running script now on WS's. do you have one for finding psts in user shares?

5:39 AM  
Anonymous Anonymous said...

I received the same error as Abishek.

Thanks

5:52 AM  
Blogger Alexis said...

For work with exchange and other mails files-microsoft exchange pst password recovery,application is free as how as i remember,it works with the following mail accounts and services, such as IMAP mail servers, POP3 mail servers, Microsoft Exchange Server, web-based email and Microsoft Mail,except mail accounts, the program can unlock password protected files with *.pst extension,will sort all characters and find a password for you,recover passwords Outlook Exchange, when you cannot recover the password of an Exchange .pst or forgotten password Outlook Exchange Server.

11:26 AM  
Blogger Alex said...

I lost my password by ms outlook yesterday and friend advised-pst file password recovery.As he said tool has many other capacities and is free.It can recover lost or forgotten passwords for the mail accounts and *.pst files of the Microsoft Outlook mail client.

12:53 PM  
Blogger Alexis said...

With mails I worked for a long time,but programs for recover them I saw many.But one of them for me is the best-outlook 2003 pst recovery.Because it is free,program is reliable,besides that it can too view recovered messages in *.eml format even without Microsoft Outlook email client.

7:23 AM  
Anonymous Poll Script said...

Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.
Real Estate Script

10:57 PM  
Anonymous Anonymous said...

Script queries ALL available drive letters, which will slow the time to completion.
Is there a refinement of the GetObject() query that asks the cimv2 namespace for just local drives ?

otherwise, great scrip - thanks
Uncle_Nick

8:56 AM  
Anonymous web development company said...

Great post and very well written, that will really help you to learn Web Design, web development and SEO Strategies to help businesses web design company . You can find out many useful information about web design, seo and his work by visiting his blog and I Just wanna say thanks you for the information you have shared. Web Design Company India

5:20 AM  
Anonymous Anonymous said...

For many people, the first type of Men’ Footwear that we believe that during the consideration of Hogan scarpe for men in May of tennis shoes or even a generic cross-training shoes. For others, they believe in May of Hogan scarpe donna , it depends on your background. In fact, this category of hogan donna covers a wide range of sports shoes and leisure activities ranging from golf and basketball and soccer shoes race. I tend to buy Hogan scarpe uomo against training only because I am involved in a wide range of sports and weightlifting, the race to play basketball.

5:45 PM  
Blogger katty said...

Interesting blog, i usally be aware all about all different kind of sofware. i am online all the time, and this action allowed me to see a site costa rica homes for sale and i like it too much, beyond all doubt without my computer and a great network i never would have seen this site too.

7:42 AM  
Blogger JD said...

thanks! works great!

2:51 PM  
Blogger JD said...

This comment has been removed by the author.

2:51 PM  
Anonymous Anonymous said...

PLEASE help
hi I have the same error as form the comment below:



C:\>cscript Searchpst.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\Searchpst.vbs(6, 1) Microsoft VBScript compilation error: Expected statement

1:16 PM  
Anonymous buy vps said...

This is really amazing. You helped me to open up my eyes. Thanks for publishing and I'm looking forward to your new posts.
John F. from VpsWebServer.
Visit us and learn all about vps hosting.

5:08 AM  
Anonymous vps hosting said...

Wonderful blog post,I will save it to favorites and let all my friends know about it. It's been a pleasure to read something like this.

Learn all about Microsoft Exchange.

5:10 AM  
Anonymous Anonymous said...

This was SO helpful! Thank you so much!!!!

11:21 AM  
Anonymous Brad Fallon said...

Do pst files contain all the profile information needed to set up Outlook 03 on a new computer?

6:37 AM  
Anonymous fico score said...

Two PST files in my laptop, one ask for password other cant be access denied how do i solve this problem?

4:23 AM  
Blogger tweety said...

Nice stuff for sharing. Thanks to you! G&G is a software developer for mobile

11:26 AM  
Anonymous 1st birthday themes said...

How to import .pst files from another email account in such a way dat those emails do not mix with d existing?

7:52 AM  
Anonymous 1 year old birthday party said...

Two PST files in my laptop, one ask for password other cant be access denied how do i solve this problem?

12:46 PM  
Anonymous sexshoptienda.wordpress.com said...

Quite effective material, thank you for the article.

10:09 AM  
Anonymous shmoogle said...

How to import .pst files from another email account in such a way dat those emails do not mix with d existing?

9:30 AM  
Anonymous eb-5 visa said...

How to import .pst files from another email account in such a way dat those emails do not mix with d existing?

7:43 AM  
Anonymous icon brickell said...

Why do i get an application error whenever i open a new window?

8:41 AM  
Anonymous Anonymous said...

if you don't respond to errors which people are encountering then this is pretty useless!

C:\>cscript Searchpst.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\Searchpst.vbs(6, 1) Microsoft VBScript compilation error: Expected statement

2:44 AM  
Anonymous Anonymous said...

C:\Searchpst.vbs(6, 1) Microsoft VBScript compilation error: Expected statement

Probably a formatting error?

5:39 AM  
Anonymous Anonymous said...

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery("select * from CIM_DataFile Where Extension = 'pst'")

Set fso = CreateObject("Scripting.FileSystemObject")

Set wfile = fso.opentextfile("c:\pst\test.csv",2,true)

For Each objFile in colFiles

Wfile.writeline(strComputer & " " & objFile.Drive & " " & objFile.Path & " " & objFile.FileName & "." & objFile.Extension & " " & objFile.FileSize)

Next

Working script

5:22 AM  
Anonymous Anonymous said...

Pstviewer.com has software for viewing and searching .pst files without Outlook.

2:34 PM  
Blogger oakleyses said...

louis vuitton outlet, oakley sunglasses, michael kors handbags, cheap jordans, prada handbags, uggs outlet, michael kors outlet, oakley sunglasses, uggs on sale, ray ban sunglasses, burberry outlet, tiffany jewelry, uggs on sale, kate spade, gucci handbags, ray ban sunglasses, prada outlet, longchamp outlet, louboutin uk, burberry factory outlet, tory burch outlet, nike air max, tiffany jewelry, christian louboutin, louboutin shoes, oakley sunglasses, cheap oakley sunglasses, chanel handbags, michael kors outlet store, louis vuitton outlet, nike outlet, ralph lauren polo, louis vuitton, christian louboutin, michael kors outlet online, longchamp outlet, uggs outlet, michael kors outlet online, nike air max, longchamp bags, replica watches, ralph lauren outlet, oakley sunglasses, ray ban sunglasses, louis vuitton outlet online, nike free, michael kors

6:30 PM  
Blogger oakleyses said...

burberry pas cher, lunette oakley pas cher, coach outlet, kate spade outlet, true religion jeans, converse, coach outlet, longchamp soldes, north face uk, michael kors, louboutin pas cher, new balance, lululemon outlet, coach purses, nike air max, hermes pas cher, nike tn pas cher, vans pas cher, coach outlet store online, mulberry uk, lunette ray ban pas cher, nike air max uk, sac guess pas cher, nike air force, nike roshe run pas cher, longchamp pas cher, north face pas cher, nike air max pas cher, ray ban uk, true religion outlet, abercrombie and fitch, polo lacoste pas cher, true religion outlet, michael kors, jordan pas cher, nike free, polo ralph lauren uk, vanessa bruno pas cher, true religion outlet, hogan sito ufficiale, ralph lauren pas cher, michael kors outlet online, nike free pas cher, nike roshe uk, abercrombie and fitch UK, nike blazer pas cher, hollister uk

6:31 PM  
Blogger oakleyses said...

converse shoes outlet, salvatore ferragamo, timberland boots, softball bats, herve leger, ray ban, hollister, louboutin, gucci, nike roshe run, iphone cases, beats by dre, mcm handbags, oakley, p90x workout, insanity workout, wedding dresses, abercrombie and fitch, abercrombie, nike air max, mac cosmetics, babyliss pro, valentino shoes, bottega veneta, mont blanc, converse, jimmy choo outlet, hollister clothing, nike air max, north face outlet, new balance shoes, north face outlet, instyler ionic styler, soccer shoes, lululemon outlet, asics running shoes, ghd hair, giuseppe zanotti, soccer jerseys, nfl jerseys, longchamp uk, reebok outlet, nike air huarache, chi flat iron, hermes handbags, vans outlet, polo ralph lauren, celine handbags, nike trainers uk, vans scarpe

6:34 PM  
Blogger oakleyses said...

toms shoes, supra shoes, montre pas cher, ugg uk, juicy couture outlet, moncler, lancel, michael kors outlet online, ugg pas cher, michael kors handbags, barbour, doke & gabbana, michael kors outlet, coach outlet, louis vuitton uk, canada goose jackets, pandora charms, moncler, ugg,ugg australia,ugg italia, links of london uk, moncler jackets, hollister, juicy couture outlet, canada goose outlet, swarovski uk, pandora jewelry, canada goose pas cher, canada goose outlet, marc jacobs, moncler pas cher, thomas sabo uk, swarovski jewelry, karen millen uk, louis vuitton, moncler, moncler uk, sac louis vuitton, canada goose, moncler outlet, louis vuitton, canada goose, wedding dresses uk, ugg,uggs,uggs canada, canada goose uk, sac louis vuitton, moncler, replica watches, barbour jackets uk, bottes ugg pas cher, canada goose jackets

6:35 PM  
Blogger Junda Xu said...

20151026 junda
michael kors outlet
louis vuitton outlet
nfl jerseys
cheap ugg boots
Coach Factory Outlet Online Sale
air max 95,nike golf,nike janoski,air max 1,nike canada,nike plus,nike shox,nike factory store
Louboutin Red Bottoms Shoes Outlet
oakley sunglasses
louis vuitton outlet
ralph lauren polo
michael kors outlet
michael kors outlet sale
ugg boots
Authentic Louis Vuitton Handbags Cheap Online
mont blanc
michael kors outlet
Gucci Outlet Online Sale
michael kors handbags
Authentic Louis Vuitton Belts Outlet Store
michael kors outlet
Coach Factory Outlet Private Sale
true religion jeans
tory burch outlet
Oakley Vault Outlet Store Online
hollister clothing store
nike trainers
Louis Vuitton Handbags Official Site
michael kors handbag
Louis Vuitton Handbags Factory Store
uggs australia

1:16 AM  
Blogger Minko Chen said...

adidas outlet
soccer jerseys wholesale
michael kors handbags
mulberry outlet store
prada outlet
cheap nba jerseys
ralph lauren uk
swarovski crystal
oakley sunglasses wholesale
chanel handbags outlet
ralph lauren outlet
cheap jordan shoes
canada goose coats
toms outlet store
puma outlet
north face outlet store
ugg boots
black friday deals
ugg outlet
toms outlet
1128minko

6:45 PM  
Blogger xumeiqing said...

151202meiqing
michael kors
ugg slippers
coach factory outlet
coach outlet
cheap toms shoes
mulberry handbags
ugg boots clearance
gucci handbags
air jordan retro
michael kors bag
louis vuitton outlet
louis vuitton
oakley sunglasses
swarovski jewelry
air max 90
cheap oakley sunglasses
coach outlet
north face uk
ugg boots
toms outlet
retro jordans
jordans
oakley sunglasses wholesale
michael kors uk
oakley sunglasses
hollister kids
michael kors handbags
canada goose outlet
polo ralph lauren outlet
michaek kors outlet
oakley sunglasses
ugg boots
nike air max
abercrombie and fitch
ray-ban sunglasses
louis vuitton handbags
louis vuitton
fitflops sale clearance
burberry outlet
michael kors outlet online

5:39 PM  
Blogger 小 Gg said...

michael kors handbags wholesale
coach outlet
ugg boots
black friday
ralph lauren outlet
mulberry,mulberry handbags,mulberry outlet,mulberry bags,mulberry uk
lebron 12
cheap uggs
cheap oakley sunglasses
vans sneakers
louis vuitton bags on sale
nhl jerseys wholesale
football shirts uk,soccer jerseys uk,cheap soccer jerseys uk
tory burch handbags
uggs on sale
tods shoes
marc jacobs outlet
polo ralph lauren
ugg outlet store
ugg outlet
cheap oakley sunglasses
nfl jerseys wholesale
michael kors factory store,michael kors outlet online sale,michael kors,kors outlet,michael kors outlet,michael kors handbags,michael kors outlet online,michael kors handbags clearance,michael kors purses,michaelkors.com,michael kors bags,michael kors shoes,michaelkors,cheap michael kors
hermes bags
converse sneakers
cheng1202

12:08 AM  
Blogger John said...

burberry outlet
ugg boots
toms outlet
ugg boots
nike roshe run
ugg outlet
coach outlet online
louboutin pas cher
cheap oakley sunglasses
ugg boots on sale
the north face outlet
nike air force 1
ugg boots
michael kors outlet online
beats by dre
ralph lauren outlet
canada goose
coach outlet online
chanel handbags
michael kors handbags
louis vuitton outlet stores
canada goose outlet
cheap jordans
uggs outlet
michael kors handbags
louis vuitton handbags
louis vuitton outlet
coach factory outlet
abercrombie & fitch
uggs on sale
oakley sunglasses wholesale
polo ralph lauren
20151203yuanyuan

7:14 PM  
Blogger Chen Jeje said...

chrome hearts wholesale
michael kors handbags
black huaraches
cheap air jordan
cheap true religion jeans
mlb jerseys authentic
kobe sneakers
christian louboutin outlet
tiffany jewellery
cheap jerseys from china
tiffany and co
cheap nfl jerseys
true religion
mlb jerseys authentic
tiffany and co jewellery
oakley sunglasses
true religion sale
tiffany online
Michael Kors Outlet Online
tiffany and co outlet
true religion jeans
michael kors outlet

7:20 PM  

Post a Comment

<< Home

xml:lang="en" lang="en"> MS Exchange Tips: Exchange: Search Network For PST Files