Created
June 3, 2021 15:48
-
-
Save sandeep-sr/b8e43f67a370b29886f61311424c54e7 to your computer and use it in GitHub Desktop.
Revisions
-
sandeep-sr created this gist
Jun 3, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ Import-Module Active* $userdata=get-content c:\temp\useraccounts.txt foreach($user in $userdata) { try { $Disabled=(Get-ADUser -Identity $user).Enabled if($Disabled -match "False") { Write-Output "$user is disabled" Write-Output "$user"|Out-File c:\temp\Disabled.txt -Append } elseif($Disabled -match "True") { Write-Output "$user is exists" Write-Output "$user"|Out-File c:\temp\enabled.txt -Append } else { Write-Output "either a contact/account not exists" Write-Output "$user"|Out-File c:\temp\conno.txt -Append } } catch { Write-Output "$user is contact" Write-Output "$user"|Out-File c:\temp\contact.txt -Append } }