O R G A N I C / F E R T I L I Z E R: 07.11

Jul 26, 2011

ds: logon request fails when groups > 1024

it's probably not logical for you to do this to yourself and thus there is not much to worry about. however, through a series of nesting groups, you can very well do this without thinking much about it. anyway, by the nature of the fact that I am posting this ... means I ran into it. :(

for clarity, the group limitation is actually 1015 when you factor in well-known SIDs.

 

the error message

this is what you will see when attempting to log in:

The system cannot log you on due to the following error: During a logon attempt, the user’s security context accumulated too many security IDs. Please try again or consult your system administrator.

 

detecting the problem

if you want to see how many groups you (or some other user account) is a member of, use the following kinds of commands (may produce different results*):

powershell

Get-QADUser myuserid | Select-Object -ExpandProperty allmemberof | measure

cmd shell
dsquery user -samid myuserid | dsget user -memberof -expand | find /c /v ""

* when I ran them side by side, I had different counts. using dsquery, it lists all security groups. using get-qaduser, it seems to list only the groups by which you don't already have membership. basically, if someone created a group and added domain users as a nested group, get-qaduser doesn't show it.

 

more information

here are two great articles for this information:

http://support.microsoft.com/kb/906208

http://support.microsoft.com/kb/328889

Jul 6, 2011

getting the first and last day of the month in sql

astronomical clock courtesy of simpologisti was putting this together for a friend of mine so i thought i would post it since it seems like a pretty useful thing to have. should be self-explanatory.

-- first and last for previous month
DECLARE @FirstDayPrev DATETIME
DECLARE @LastDayPrev DATETIME

-- first and last for current month
DECLARE @FirstDayCurr DATETIME
DECLARE @LastDayCurr DATETIME

Set @FirstDayPrev = CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(mm,0,getdate())-1, 0),101)
Set @LastDayPrev = CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(mm, 0,getdate())+0, -1),101)

Set @FirstDayCurr = CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(mm, 0,getdate())+0, 0),101)
Set @LastDayCurr = CONVERT(VARCHAR(25),DATEADD(mm, DATEDIFF(mm, 0,getdate())+1, -1),101)

Select @FirstDayPrev, @LastDayPrev, @FirstDayCurr, @LastDayCurr