added exclusion logic

This commit is contained in:
poslop
2025-02-10 12:06:29 -06:00
parent b540653fc3
commit dac4075676

View File

@@ -7,10 +7,10 @@ $excludedProfiles = @("Default User", "administrator")
$inactiveDate = (Get-Date).AddDays(-$daysInactive) $inactiveDate = (Get-Date).AddDays(-$daysInactive)
$profiles = Get-WmiObject Win32_UserProfile
# Get all user profiles # Get all user profiles
Get-WmiObject Win32_UserProfile | :Loop ForEach-Object { :Loop ForEach-Object ($profile in $profiles) {
$profile = $_
$userFolder = $profile.LocalPath $userFolder = $profile.LocalPath
$userName = $profile.LocalPath.Split('\')[-1] # Get the username from the folder path $userName = $profile.LocalPath.Split('\')[-1] # Get the username from the folder path
$nameIsExcluded = false $nameIsExcluded = false