June 30, 2017 at 12:55 am
Good morning
is there a t-sql command which I can run from within sql to get the installation folder permissions?
Thanks
June 30, 2017 at 10:43 am
Not that I'm aware of. You'd need to be able to use Windows Explorer or the CACLS command at a command prompt (Not SQLCMD). If you don't have the rights to see the folder, neither of those methods will work, and you'll need a server admin to do it instead.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
June 30, 2017 at 11:03 am
Not directly. You'd have to shell out to get the information using the command line. But even if you get to the point you need to be in executing it, it is still pretty ugly to parse, would likely want to use a lookup table, etc. icacls is the replacement for cacls which is being deprecated. I was just playing around with it doing what you are looking for. If you have xp_cmdshell enabled, you can do something like this to get the ugly results that would need a lot of work:
DECLARE @STR as varchar(100)
DECLARE @DataRoot varchar(100)
SET @STR = 'icacls '
EXECUTE master.sys.xp_instance_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'Software\Microsoft\MSSQLServer\Setup',
@value_name = 'SQLDataRoot',
@value = @DataRoot OUTPUT;
SET @STR = @STR + '"' + @DataRoot + '"'
EXEC xp_cmdshell @STR
Tools other than t-sql would be better - Powershell would be a good option. There are other products that can be used. I can't remember which one from sysinternals DumpAcls or something like that.
Sue
July 3, 2017 at 12:11 am
thanks I will give this one a try.Permission is handled by our sysadmin department on the moment and I want to double check.I also do not have access to go directly on the server.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply