Hi,
I wonder if anyone can help me with the script (below).
This is for checking and exporting the NTUSER.DATfile "modified date" (for all users) on a share, to a spreadsheet.
The script runs without errors but exports modified date for all folders and files (for all users) to excel.
I only want the information for NTUSER.DAT
Any help on modifying the script to desired effect appreciated.
Thanks in advance
Script:
............................................
Option Explicit
Dim strFolder, objFSO, objFolder
Dim strExcelPath, objExcel, objSheet, intRow
Const xlExcel7 = 39
' Specify main folder.
strFolder = "D:\test"
' Retrieve folder object.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
' Specify spreadsheet to be created.
strExcelPath = "d:\test\user.xls"
' Create workbook.
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
' Bind to worksheet.
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
' Enumerate files.
intRow = 0
Call GetFiles(objFolder)
' Save spreadsheet, close workbook, and quit Excel.
objExcel.ActiveWorkbook.SaveAs strExcelPath, xlExcel7
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
' Alert user.
Wscript.Echo "Done"
Sub GetFiles(ByVal objParent)
' Enumerate files in folder.
' Variable intRow must have global scope.
Dim objFile, objChild
For Each objFile In objParent.Files
intRow = intRow + 1
objSheet.Cells(intRow, 1).Value = objFile.Path
objSheet.Cells(intRow, 2).Value = objFile.DateLastModified
Next
' Recurse through nested folders.
For Each objChild In objParent.SubFolders
Call GetFiles(objChild)
Next
End Sub
..............................................................
I wonder if anyone can help me with the script (below).
This is for checking and exporting the NTUSER.DATfile "modified date" (for all users) on a share, to a spreadsheet.
The script runs without errors but exports modified date for all folders and files (for all users) to excel.
I only want the information for NTUSER.DAT
Any help on modifying the script to desired effect appreciated.
Thanks in advance
Script:
............................................
Option Explicit
Dim strFolder, objFSO, objFolder
Dim strExcelPath, objExcel, objSheet, intRow
Const xlExcel7 = 39
' Specify main folder.
strFolder = "D:\test"
' Retrieve folder object.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
' Specify spreadsheet to be created.
strExcelPath = "d:\test\user.xls"
' Create workbook.
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
' Bind to worksheet.
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
' Enumerate files.
intRow = 0
Call GetFiles(objFolder)
' Save spreadsheet, close workbook, and quit Excel.
objExcel.ActiveWorkbook.SaveAs strExcelPath, xlExcel7
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
' Alert user.
Wscript.Echo "Done"
Sub GetFiles(ByVal objParent)
' Enumerate files in folder.
' Variable intRow must have global scope.
Dim objFile, objChild
For Each objFile In objParent.Files
intRow = intRow + 1
objSheet.Cells(intRow, 1).Value = objFile.Path
objSheet.Cells(intRow, 2).Value = objFile.DateLastModified
Next
' Recurse through nested folders.
For Each objChild In objParent.SubFolders
Call GetFiles(objChild)
Next
End Sub
..............................................................