On Error Resume Next ''' Set Registry Hive Const HKEY_LOCAL_MACHINE = &H80000002 ''' This section of code creates the list of user profiles ''' strComputer = "." Set objRegistry=GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys ''' Create a loop to cycle through the profiles ''' For Each objSubkey In arrSubkeys strValueName = "ProfileImagePath" strSubPath = strKeyPath & "\" & objSubkey objRegistry.GetExpandedStringValue _ HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue strValue = strValue & "\Desktop" ''' Delete any file on desktop that is older than one day old ''' Skip the default user desktop (although this may not be necessary) If NOT strValue ="C:\WINDOWS\system32\config\systemprofile\Desktop" _ Then Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(strValue) Then Set Folder = objFSO.GetFolder(strValue) For Each File in Folder.Files If DateDiff("d",File.DateLastModified,Now) > 1 Then _ objFSO.DeleteFile File Next End If End If Set objFSO = Nothing Next Set objRegistry = Nothing
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE