PS: Remove users from the old VDI solution
Part 3 of 3
The last step is to revoke access, to the old VDI environment, from the users in the list generated from the script in the previous post. The CSV file contains the list of users who have access to both old and new VDI environments. Revoking their access will still leave them with access to the new environment.The kicker - some users have been identified as exceptions until their workflows are supported in the new VDI solution. They have been identified by their IDs in the $Exceptions variable.
Script
$Old_VDI_Users = Import-Csv .\UserMembers.csv $Exceptions = "Exception1", "Exception2", "Exception3", "Exception4", "Exception5", "Exception6", $Old_VDI_Group = "Old_VDI_Group" Start-Transcript -Path .\Citrix_V2_Purge-NonExceptions.txt foreach ($User in $Old_VDI_Users){ Write-Host "Removing " ($User.SAMAccountName) "... " -NoNewline if ($Exceptions -contains $User.SamAccountName) { Write-Host " [SKIP - EXCEPTION]" -ForegroundColor Yellow } else { Remove-ADGroupMember -Identity $Old_VDI_Group ` -Members $User.SAMAccountName ` -Confirm:$false Write-Host " [OK]" } } Stop-Transcript
No comments