EXEC sp_configure 'show advanced options',1 RECONFIGURE go EXEC sp_configure 'xp_cmdshell',1 RECONFIGURE Go DECLARE @cmd varchar(200) = 'DIR \\Your share name and path\*.* /b' EXEC xp_cmdshell @cmd