From 048a28537c63fd9dede6f891bd2a6d6c840aeeb8 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 18 Aug 2022 18:41:03 -0400 Subject: [PATCH] additional output for troubleshooting --- Remove-OldRevitLocals.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Remove-OldRevitLocals.ps1 b/Remove-OldRevitLocals.ps1 index 0afb82c..33cc56b 100644 --- a/Remove-OldRevitLocals.ps1 +++ b/Remove-OldRevitLocals.ps1 @@ -4,13 +4,15 @@ $FileAllowedAge = (Get-Date).AddMonths(-1) # Build all Revit local paths $RevitLocalPaths = @() ForEach ( $userProfile in (Get-ChildItem -Path "${Env:SystemDrive}\Users" | Where-Object { $_.PSIsContainer }) ) { - If ( Test-Path "${userProfile}\Documents\Revit Locals" ) { $RevitLocalPaths.Add("${userProfile}\Documents\Revit Locals") } - If ( Test-Path "${userProfile}\Documents" ) { $RevitLocalPaths.Add("${userProfile}\Documents") } + If ( Test-Path "${userProfile}\Documents\Revit Locals" ) { LogMsg "Adding search path: ""${userProfile}""" ; $RevitLocalPaths.Add("${userProfile}\Documents\Revit Locals") } + If ( Test-Path "${userProfile}\Documents" ) { LogMsg "Adding search path: ""${userProfile}""" ; $RevitLocalPaths.Add("${userProfile}\Documents") } } ForEach ( $path in $RevitLocalPaths ) { + LogMsg "Searching ""${path}"" for Revit files" $RevitFiles = Get-ChildItem -Path "${path}\*.*" -Filter '*.rvt' | Where-Object {$_.LastWriteTime -lt $FileAllowedAge} If ( $RevitFiles ) { + LogMsg "Revit files found. Searching for Revit files with worksharing enabled" ForEach ($revitfile in $RevitFiles) { $parentDir = $revitfile.DirectoryName