Thursday, February 18, 2010

For inboxes information to export to excel for single system complete list

Script for complete Inboxes checks to export the results to Excel file

sStartPath = "\\your sccmservername\SMS_smssitecode\inboxes\"
Set oFSO = CreateObject("Scripting.FileSystemObject")

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2

objExcel.Cells(1, 1).Value = "Directory"
objExcel.Cells(1, 2).Value = "Count"

ListFolders(sStartPath)

Sub ListFolders(sPath)
Set oFolder = oFSO.GetFolder(sPath)
objExcel.Cells(intRow, 1).Value = oFolder.Path
objExcel.Cells(intRow, 2).Value = oFolder.Files.Count
intRow = intRow + 1

For Each oFldr In oFolder.SubFolders
ListFolders oFldr.Path
Next
End Sub

Set sStartPath = Nothing
Set objExcel = Nothing

objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit

No comments: