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
goprasadAsked:
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.
0
 
NVITCommented:
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"
0
 
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
\\servername\Profiles$.
del /s "\\servername\Profiles$\*.pst"  - this command will delete pst files located in Profiles$

and what does the following command do?

>"%temp%\DeletedPSTs.txt"
0
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.
0
 
JohnBusiness Consultant (Owner)Commented:
@goprasad  - Thanks, and I was happy the help you.
0
 
NVITCommented:
Thanks for the update,  goprasad. I'm glad it worked for you. Have a nice day...
0
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.