I want to run a report to make sure the password of every user is set to expire every 30 days, but the expiration interval doesn't seem to be stored in syslogins?
A:
You can use sp_configure to set all users password expiration date
sp_configure "systemwide password expiration", 30
go
will set all users passwords to expire after 30 days. Not sure if this value can be read for a report though. The default is 0.
Paul Owens
2009-07-22 08:22:46
Be very careful - you're already attracting spam flags.
Marc Gravell
2009-12-18 09:33:54
+1
A:
you can get report with following proc:
use sybsystemprocs
go
----------------------------------------------------------------------------
print 'sp__helpexpire'
----------------------------------------------------------------------------
if exists (select 1 from sysobjects where type = "P" and name = "sp__helpexpire")
drop proc sp__helpexpire
go
create procedure sp__helpexpire
as
begin
set nocount on
declare @swexpire int
select @swexpire=value from master.dbo.sysconfigures
where name = 'systemwide password expiration'
print "Serverwide password expire: %1!" ,@swexpire
print ""
print "Logins:"
print "=============================================================="
select l.name login , case a.int_value
when null then @swexpire
else a.int_value end "expire in days"
from master.dbo.syslogins l , master.dbo.sysattributes a
where l.suid *= a.object
and a.object_type='PS'
and a.attribute=0
and object_cinfo='login'
print ""
print "Roles:"
print "=============================================================="
select r.name "role name", case a.int_value
when null then @swexpire
else a.int_value end "expire in days"
from master.dbo.syssrvroles r , master.dbo.sysattributes a
where r.srid *= a.object
and a.object_type='PS'
and a.attribute=0
and object_cinfo='role'
end
go
it is always a good idea to check source code of those system procedures (stored in sybsystemprocs database) which manipulate with records you are looking for (in this case it is sp_addlogin, sp_modifylogin)
mj
2010-01-15 12:27:12