From 09fdfa51097933d277c503de815ba924d49b94f2 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Mon, 26 Feb 2024 16:27:58 -0500 Subject: [PATCH] a little more specific --- Get-BackupCapacityPlanningData.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Get-BackupCapacityPlanningData.ps1 b/Get-BackupCapacityPlanningData.ps1 index 2b4d63c..7ba26f7 100644 --- a/Get-BackupCapacityPlanningData.ps1 +++ b/Get-BackupCapacityPlanningData.ps1 @@ -14,8 +14,8 @@ Function Add-UserProfilePaths { ForEach ( $profile in (Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList') ) { $profileImagePath = Get-ItemPropertyValue -Path $([System.Environment]::ExpandEnvironmentVariables($profile.PSPath)) -Name ProfileImagePath - # Skip profiles located in C:\Windows as MSP360 doesn't currently include these when using the %UserProfile% variable - If ( $profileImagePath -ilike "*${Env:WinDir}*" ) { Continue } + # Skip profiles located outside C:\Users as MSP360 doesn't currently include these when using the %UserProfile% variable + If ( !($profileImagePath -ilike "*${Env:SystemDrive}\Users\*") ) { Continue } # Build the path we're trying to add $path = Join-Path -Path $profileImagePath -ChildPath $ChildPath