How to enable FILESTREAM from the command line.

Tuesday, June 03, 2008

The FILESTREAM feature in SQL 2008 is off by default. It must be enabled by a box administrator either during instance setup or post-setup using the SQL Configuration Manager UI.

The VBScript below allows you to enable FILESTREAM for a particular instance post-setup from the command line. The caller must be box admin to run the script.

Also note, that once a box administrator has enabled the feature on the box, the SQL admin must connect to the instance and configure the feature using sp_configure.

More details are at: http://blogs.msdn.com/sqlserverstorageengine/archive/2008/03/03/filestream-configuration-and-setup-changes-in-sql-server-2008-february-ctp.aspx

Download the script by clicking on the Releases tab, then clicking on EnableFilestream.zip.

Usage

cscript filestream_enable.vbs [/Machine:MachineName] [/Instance:InstanceName] [/Level:level] [/Share:ShareName]

Parameters:

Machine: Target machine name. If not specified, local machine is the default.

Instance: Target instance. If not specified, default instance (MSSQLSERVER) is default.

Level: Level of FILESTREAM functionality to enable, a integer between 0 and 3. If not specified, level 3 is default.
0 - FILESTREAM functionality disabled.
1 - Enable FILESTREAM for T-SQL access.
2 - Enable FILESTREAM for T-SQL and file I/O streaming access but do not allow remote clients file I/O streaming access.
3 - Enable FILESTREAM for T-SQL and file I/O streaming access and allow remote client streaming access.

Share: Name of windows share that is created for file I/O streaming access to FILESTREAM data. If not specified, instance name is default.


Examples:

cscript filestream_enable.vbs

This will enable FILESTREAM on the local machine for the default instance MSSQLSERVER. The feature will be enabled for T-SQL and file I/O streaming access and the windows share MSSQLSERVER will be created.


cscript filestream_enable.vbs /Machine:. /Instance:SQLEXPRESS /Level:2 /Share:SQLEXPRESSLOCAL

This will enable FILESTREAM on the local machine for the instance SQLEXPRESS. The feature will be enabled for T-SQL and file/IO streaming access. Remote client file I/O streaming access is disabled. The windows share SQLEXPRESSLOCAL will be created.