How to setting user "AD Deny logon through Remote Desktop Services" in Remote Desktop Services tab.


there 5000+ users in company

some users option checked on . how cancel with powershell or other  script ?


  $fi = [adsisearcher]"(objectclass=user)" $fi.pagesize = 1000  $users = $fi.findall() foreach ($user in $users) { 	$user = $user.getdirectoryentry() 	if($user.allowlogon -eq 0) 	{ 		$user.allowlogon = 1 		$user.commitchanges() 	} }  



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL