diff --git a/scripts/DeleteOldProfiles.ps1 b/scripts/DeleteOldProfiles.ps1 index 4b532ad..103728e 100644 --- a/scripts/DeleteOldProfiles.ps1 +++ b/scripts/DeleteOldProfiles.ps1 @@ -55,7 +55,7 @@ ForEach ($profile in $profiles) { #Calculation of the login date $lastLoginDate = $null - If ($accountDomain.ToUpper() -eq $computer.ToUpper()) {$lastLoginDate = [datetime]([ADSI]"WinNT://$computer/$accountName").LastLogin[0]} + If ($accountDomain.ToUpper() -eq $ComputerName.ToUpper()) {$lastLoginDate = [datetime]([ADSI]"WinNT://$ComputerName/$accountName").LastLogin[0]} #Calculation of the unused days of the profile $profileUnusedDays=0 @@ -80,7 +80,7 @@ ForEach ($profile in $profiles) { $profilesFound ++ If ($profilesFound -gt 1) {Write-Host "`n"} - Write-Host "`nStart deleting profile ""$account"" on computer ""$computer"" ..." -ForegroundColor Red + Write-Host "`nStart deleting profile ""$account"" on computer ""$ComputerName"" ..." -ForegroundColor Red Write-Host "Account SID: $sid" Write-Host "Special system service user: $special" Write-Host "Profile Path: $profilePath"