Hi All,
I have a script to backup only user profiles that have been modified in the last xx days.
I would be most grateful if anyone could help me resolve or point me in the right direction as to why the script is failing on the line in bold text
'Modified code to get last access time
Dim strPath, objFile, objNTUserFile, objLastAccessDate,
strPath=objWshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & strSubkey & "\ProfileImagePath")
strPath = strPath + "\NTUSER.DAT"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNTUserFile = objFSO.GetFile(strPath)
ShowDebugMessage strPath & " modified: " & CDate(objNTUserFile.DateLastModified)
'Calculate the date 30 days ago
objLastAccessDate = DateAdd("d", -30, Now())
If(objNTUserFile.DateLastModified > objLastAccessDate) Then
ShowDebugMessage "Profile modified in the last 30 days."
Else
ShowDebugMessage "Profile NOT modified in the last 30 days."
blnSkip=true
End If
End If
Many thanks,
Keith
I have a script to backup only user profiles that have been modified in the last xx days.
I would be most grateful if anyone could help me resolve or point me in the right direction as to why the script is failing on the line in bold text
'Modified code to get last access time
Dim strPath, objFile, objNTUserFile, objLastAccessDate,
strPath=objWshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & strSubkey & "\ProfileImagePath")
strPath = strPath + "\NTUSER.DAT"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNTUserFile = objFSO.GetFile(strPath)
ShowDebugMessage strPath & " modified: " & CDate(objNTUserFile.DateLastModified)
'Calculate the date 30 days ago
objLastAccessDate = DateAdd("d", -30, Now())
If(objNTUserFile.DateLastModified > objLastAccessDate) Then
ShowDebugMessage "Profile modified in the last 30 days."
Else
ShowDebugMessage "Profile NOT modified in the last 30 days."
blnSkip=true
End If
End If
Many thanks,
Keith