This VBS script will prompt you for a site server name, site code and inbox and will count the files in the specified inbox and send the results to an Excel spreadsheet.
VBS Script:
strSiteServer = InputBox ("Enter Site Server Name")
strSiteCode = InputBox ("Enter Site Code")
strInbox = InputBox ("Enter InBox Name",, "CcrRetry.Box")
objGetPath = "\\" & strSiteServer & "\SMS_" & strSiteCode & "\Inboxes\" & strInbox
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Site Server"
objExcel.Cells(1, 2).Value = "Site Code"
objExcel.Cells(1, 3).Value = UCase(strInbox) & " Count"
ListFolders(objGetPath)
Sub ListFolders(sPath)
Set oFolder = oFSO.GetFolder(sPath)
objExcel.Cells(intRow, 1).Value = UCase(strSiteServer)
objExcel.Cells(intRow, 2).Value = UCase(strSiteCode)
If objExcel.Cells(intRow, 3).Value = "" Then
objExcel.Cells(intRow, 3).Value = "None"
Else
objExcel.Cells(intRow, 3).Value = oFolder.Files.Count
End If
intRow = intRow + 1
For Each oFldr In oFolder.SubFolders
ListFolders oFldr.Path
Next
End Sub
objExcel.Range("A1:C1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
MsgBox "Done"
No Comments