@Vikram Midha
Thanks for posting in Microsoft Q&A forum.
It is necessary to remove the security scope before deleting the collections.
What I can provide are a quicker way to find out the specific users that be assigned as security scope to and the script to removes the association between one or more security scopes and an administrative user.
To get a collection assigened as security scope to a user, please refer to the following script(replace collection name and sitecode):
$cmdletLocaltion = 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
$collectionName = '<collectionName>'
Import-Module $cmdletLocaltion
cd <sitecode>:
(Get-WmiObject -Namespace ROOT\SMS\SITE_<sitecode> -Class sms_admin | where {$_.CollectionNames -like $collectionName}).LogonName
To remove the association between the security scope and the administrative user, below is the PowerShell command: (replace AdministrativeUserName and SecurityScopeName)
Remove-CMSecurityScopeFromAdministrativeUser -AdministrativeUserName "< AdministrativeUserName >" -SecurityScopeName " <SecurityScopeName> "
You can get more details from this article: https://learn.microsoft.com/en-us/powershell/module/configurationmanager/remove-cmsecurityscopefromadministrativeuser?view=sccm-ps
Hope the above information is helpful to you.
If the response is helpful, please click "Accept Answer"and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.