Script to delete *.pst files from a user profile share

Hello there,

I would like to run a script to delete *.pst file in each of the users profile located in profile share directory.

Please assist.

Thanks and Regards
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness Consultant (Owner)Commented:
PST files hold email, so be sure you know what you are trying to delete!

Outlook MUST be closed to move, delete, or copy its PST file. So long as Outlook is closed, you can use any delete script you are familiar with.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NVITEnd-user supportCommented:
1. Make sure .PSTs to delete aren't open, i.e. Outlook not running
2. Open a CMD window
3. del /s "c:\users\*.pst">"%temp%\DeletedPSTs.txt"
goprasadAuthor Commented:
Yep will ensure that that the outlook is not running. user's *.pst files are located in network share in Citrix users profile
del /s "\\servername\Profiles$\*.pst"  - this command will delete pst files located in Profiles$

and what does the following command do?

Check Out How Miercom Evaluates Wi-Fi Security!

It's not just about Wi-Fi connectivity anymore. A wireless security breach can cost your business large amounts of time, trouble, and expense. Plus, hear first-hand from Miercom on how WatchGuard's Wi-Fi security stacks up against the competition plus a LIVE demo!

JohnBusiness Consultant (Owner)Commented:
The last command pipes the output to a text file for reference.
JohnBusiness Consultant (Owner)Commented:
@goprasad  - Thanks, and I was happy the help you.
NVITEnd-user supportCommented:
Thanks for the update,  goprasad. I'm glad it worked for you. Have a nice day...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.