Tuesday, February 14, 2012

Determining the OS Version that SQL is running on

I am writing a client application that offers an UI that allows an administrator to remotely add/delete/update user accounts accross many different SQL Servers running on XP and up.

When the operating system is W2K3 or higher I want to take advantage of the "check_expiration, check_policy, must_change' arguments to create login and exclude those features when the host OS does not support them.

Is there an easy way to determine if those arguments are supported?

Thanks

Mark

The OS version information is returned with @.@.VERSION. You will have to parse it a bit to find the Version, Edition, and Build -but it's all there.|||

or you can try this .. in sql server 2005 you have some limitation with XP_Cmdshell ... it may not be enabled by default...

EXEC master..xp_cmdshell 'netsh diag SHOW os /p'

for more details refer this link : http://www.sqlmag.com/Article/ArticleID/46062/sql_server_46062.html

Madhu

|||

Also exec xp_msver will return the OS version (I think it is line 15 in the result set)

hth,

-Steven Gott

S/DET

SQL Server

|||

exec xp_msver is exactly what I am looking for

Thanks!

No comments:

Post a Comment