Deny domain logon to certain AD accounts

There are certain user accounts within our Server 2016 Active Directory domain that we want to remain active but that we don't want these accounts to be able to be used to logon to computers.

Some of these accounts have to exist within Active Directory for the Office 365 email accounts to exist (since we are using Office 365 AD synchronization) and others are used simply for network services (so that we don't have to use the Administrator account).

How can we make it so that these AD accounts won't be able to be used to logon to our domain joined computers?
IT GuyNetwork EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott CSenior EngineerCommented:
Go to the properties of the account in ADUC and click on the "Account" tab.

Click on "Logon Hours..." and select "Logon Denied".  Click on Ok twice and you are done.
Adam BrownSr Solutions ArchitectCommented:
Or use the User Rights Assignment features of Group Policy: explains what to do. This gives you the ability to block logon to computers directly or through RDP, but still allow the account to be used as a service account or remotely through powershell.

Scott's recommendation would work for the Office 365 accounts (since logontimes is not replicated through AD Connect), but would not work for securing network services. You would need to set User Rights to allow logon as a batch or service and deny local and remote desktop login.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Todd NelsonSystems EngineerCommented:
Scott provides a great option that I previously had not attempted.  I just confirmed it works by allowing my test user to login to the EXO mailbox but not to an domain-joined workstation.

Thanks, Scott.
Naveen SharmaCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.