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?
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.
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?

Protect Your Employees from Wi-Fi Threats

As Wi-Fi growth and popularity continues to climb, not everyone understands the risks that come with connecting to public Wi-Fi or even offering Wi-Fi to employees, visitors and guests. Download the resource kit to make sure your safe wherever business takes you!

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.
Thanks for the update,  goprasad. I'm glad it worked for you. Have a nice day...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.