a little more specific

This commit is contained in:
2024-02-26 16:27:58 -05:00
parent 175248ec4d
commit 09fdfa5109
+2 -2
View File
@@ -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