I have a script to show users which haven't logged in recently which uses the Get -ADUser command with a filter on 'LastLoginTimeStamp'.
At the moment we disable accounts which haven't logged in for 90 days but I would like to take this a step further (as we are very limited on licenses) so that accounts without a license assigned are disabled after 30 days. If they already have a license assigned there isn't much point in disabling their account before that license expires.
As the Microsoft policy states 'any user with the ability to RDP must have a license' we are finding our self in the position where we have users that are not using RDP that we would like to disable and move to a group which doesn't permit RDP so we can free up a license for a new user.
I have came across multiple resources online which show how CSV reports can be produced but I can't find anything which shows how PowerShell can access this information. Is there a way or am I going to have to create a Powershell script to export a CSV license report and then another to compare the contents of that CSV to a list of users that haven't logged in within x days.
I am not looking for someone to write a script for me but to confirm if there is a way of doing this within Powershell.
Thanks,
Jack.