How to disable RDP access for many users using powershell?

0

I am trying to find a way to disable RDP access in a bulk without having to click on AD and cancel their RDP access.

Afonso Alves

Posted 2019-09-16T18:09:28.640

Reputation: 1

Question was closed 2019-09-17T00:57:43.987

That powershell didn't work for me. However I found another powershell scripting that worked:

$LDAPUrl = "LDAP://" + (Get-AdUser -Identity "aal**").DistinguishedName $DenyRemotePermission = [ADSI] $LDAPUrl $DenyRemotePermission.psbase.invokeSet("allowLogon",1) $DenyRemotePermission.setinfo() – Afonso Alves – 2019-09-16T20:01:06.803

$LDAPUrl = "LDAP://" + (Get-AdUser -Identity "aa").DistinguishedName $DenyRemotePermission = [ADSI] $LDAPUrl $DenyRemotePermission.psbase.invokeSet("allowLogon",1) $DenyRemotePermission.setinfo() – Afonso Alves – 2019-09-16T20:01:57.167

Better post an answer on the the above link. – harrymc – 2019-09-16T20:02:49.367

No answers