Finding PST and creating a report for both x86 and x64
Kace script
Hello,
I have a VBS script that will create a folder on the c drive to place the results of the search. However its not working in windows x64. I want it to run in both OSs. Also if there is a easier way to create the report.
I run the script to place the results in the folder, then run force update to pull the TXT file , then run a report .
PST VBS
strComputer = "."
on error resume next
set wshnetwork=createobject("wscript.network")
scomputername=wshnetwork.computername
set wshnetwork=nothing
Const OverwriteExisting = True
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'pst' AND (Drive = 'C:' OR Drive = 'H:' or drive'w:')")
If colFiles.Count = 0 Then
Wscript.Quit
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("C:\kbox")
Set objTextFile = objFSO.CreateTextFile("c:\kbox\pstfiles.txt" , True)
For Each objFile in colFiles
objTextFile.Write(objFile.Drive & objFile.Path & "")
objTextFile.Write(objFile.FileName & "." & objFile.Extension & ", Size ")
objTextFile.Write(objFile.FileSize /1024 & "kb" & vbCrLf)
Next
objTextFile.Close
Answers (0)
Be the first to answer this question
C:\windows\sysWOW64\cscript.exe
Try running this batch in your remediation step:
@echo off
If exist C:\windows\sysWOW64\cscript.exe (
Echo 64 bit OS... Going to Success
Exit /b 0
) else (
Echo 32 bit OS... Going to Failure
Exit /b 1
)
Success:
Run from here C:\windows\sysWOW64\cscript.exe
Failure:
Run From here C:\windows\system32\cscript.exe - Desktop Jockey 7 years ago
Running as: afisher
File does not exist: c:\kbox\pstfiles.txt
Creating process returned non-zero: C:\Windows\System32\cscript.exe C:\ProgramData\Dell\KACE\user\tmp\5r5fu9iw\packages\kbots\924/FindOutlookpst.vbs: (0) The operation completed successfully.
Error Code: 0
Status Code: 1 - Kdebiasse 7 years ago
get-childitem C:,H:,W: *.PST -recurse -erroraction SilentlyContinue | Select fullname, @{n='Size_MB';e={ "{00:N2}" -f (($_.length) / 1MB) }} | Format-Table -HideTableHeaders |Out-File c:\kbox\pstfiles.txt -force - Desktop Jockey 7 years ago
If (-not(test-path C:\kbox)) {mkdir C:\kbox} - Desktop Jockey 7 years ago