![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Sep 2008
Posts: 1
OS: xp
|
Help with script to find all .pst files
Hello,
I'm trying to create a script that searches for all .pst files on a local pc and gathers the filename, path and size and outputs that data to a file called username.txt. I am having problems with my code. It creates the username.txt but does not write the .pst file information. Please help! Code:
strComputer = "."
Const ForAppending = 2
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select Username From Win32_ComputerSystem")
For Each objItem in colItems
arrName = Split(objItem.UserName, "\")
Next
Set colItems = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'pst' AND Drive = 'C:'")
If colItems.Count = 0 Then
Wscript.Quit
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\Script\" & arrName(1) & ".txt", ForAppending, True)
For each ObjItem in colItems
objFile.Write(arrName(1)& ",")
objFile.Write(objFile.Drive & objFile.Path & ",")
objFile.Write(objFile.FileName & "." & objFile.Extension & ",")
objFile.Write(objFile.FileSize & vbCrLf)
Next
objFile.Close
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
![]() |
| Thread Tools | |
|
|