Deactivate Inactive(not logged in for 60 days) user



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


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:

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