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