Deactivate Inactive(not logged in for 60 days) user

Feb 19, 2015 at 2:06 PM

I want to deactivate FBA user who have not logged in for the last 60 days. How would I achieve this please help. I see "Last Login" listed in FBA User managment page but how do I access this information from powershell so that I could deactivate account older than 60 days

Feb 19, 2015 at 5:55 PM
You should be able to deactivate the user directly from the user management page.

I assume you want to do it through powershell to automate it? If so, you can probably use the following script as a base to do what you need:
Feb 20, 2015 at 1:41 PM
Edited Feb 24, 2015 at 3:12 AM
Thanks I ended up writing a script. Posting it here if some other may need it.
$connection = new-object System.Data.SqlClient.SQLConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=aspnetdb");
$cmd = new-object System.Data.SqlClient.SqlCommand("UPDATE dbo.aspnet_Membership SET IsApproved = 0 where LastLoginDate  < DATEADD(DAY, -30, GETDATE())", $connection);
$reader = $cmd.ExecuteNonQuery()
Write-output $reader