This project is read-only.

This is a simple console application.  The parameters are:

Required Parameters 

/server ServerName.  You can also specify server\instance.
/dir OutputDirectory.  If the output directory has spaces you'll need to enclose the entire path in quotes.  See below for an example.

Optional Parameters

/v Verbose Output
/databases Scripts database objects such as tables, stored procedures, etc.
/scriptdb Scripts a single database
/noinstance Don't script instance information
/user SQL Server user name.  It connects using trusted authentication unless you specify a SQL Server username and password.
/password The password for the SQL Server username.
/? Displays the help

Sample Usage

 

ScriptSqlConfig.EXE /server Srv1\Instance /dir "C:\MyDir"

Last edited Oct 9, 2012 at 11:48 PM by billgraziano, version 6

Comments

slancaster Mar 9, 2016 at 9:37 PM 
I love this tool!

samgreene Apr 15, 2015 at 9:33 PM 
I have a powershell script that runs ScriptSqlConfig based on a CMS server. It could be easily modified to be driven from a text file or table. Check it out...

https://github.com/propellor/Powershell

samgreene Apr 15, 2015 at 9:16 PM 
Can you run this with anything below sysadmin rights?

MarkCDavis Mar 11, 2015 at 12:30 AM 
This is probably too late for "fja" but you need the SQL Server 2012 Management Objects installed to be able to run this program. You can download them from here: http://www.microsoft.com/en-us/download/details.aspx?id=35580

sbandarla Jan 31, 2014 at 10:30 PM 
This is awesome...Tested on SQL Server 2012.
Is there anyway we can select Just Users/Roles to be scripted for User Databases? Using "/Databases" switch is scripting out every object in the database which can be very time consuming if my Instance has many databases which have thousands of objects. So, basically...I would like to skip scripting out Objects in the user databases and script only Users and Permissions and Roles. Is it possible? Thanks again for this great nifty tool :)

fja Jun 27, 2013 at 1:46 AM 
reg key created and then I execute and I am receiving this message:
C:\Users\me\Desktop>ScriptSqlConfig.EXE /server sqlservername /v /dir "C:\User
s\me\Desktop"
26/06/2013 07:43:07 p.m. : Launching (2012.3)....
26/06/2013 07:43:07 p.m. : Directory: C:\Users\me\Desktop
26/06/2013 07:43:07 p.m. : Server: sqlservername

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, PublicKeyToke
n=89845dcd8080cc91' or one of its dependencies. The system cannot find the file
specified.
File name: 'Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, PublicKe
yToken=89845dcd8080cc91'
at ScriptSqlConfig.Program.ScriptInstance(String server, String directory)
at ScriptSqlConfig.Program.Main(String[] args)

=== Pre-bind state information ===
LOG: User = SCJN\me
LOG: DisplayName = Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, P
ublicKeyToken=89845dcd8080cc91
(Fully-specified)
LOG: Appbase = file:///C:/Users/me/Desktop/
LOG: Initial PrivatePath = NULL
Calling assembly : ScriptSqlConfig, Version=2012.3.0.0, Culture=neutral, PublicK
eyToken=null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2
.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=n
eutral, PublicKeyToken=89845dcd8080cc91
LOG: Attempting download of new URL file:///C:/Users/me/Desktop/Microsoft.
SqlServer.Smo.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Desktop/Microsoft.
SqlServer.Smo/Microsoft.SqlServer.Smo.DLL.
LOG: Attempting download of new URL file:///C:/Users/me/Desktop/Microsoft.
SqlServer.Smo.EXE.
LOG: Attempting download of new URL file:///C:/Users/me/Desktop/Microsoft.
SqlServer.Smo/Microsoft.SqlServer.Smo.EXE.

fja Jun 27, 2013 at 1:39 AM 
I am receiving this error and closes program:
C:\Users\me\Desktop>ScriptSqlConfig.EXE /server sqlservername /v /dir "C:\User
s\me\Desktop"
26/06/2013 07:36:39 p.m. : Launching (2012.3)....
26/06/2013 07:36:39 p.m. : Directory: C:\Users\msft-fja\Desktop
26/06/2013 07:36:39 p.m. : Server: sqlservername

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, PublicKeyToke
n=89845dcd8080cc91' or one of its dependencies. The system cannot find the file
specified.
File name: 'Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, PublicKe
yToken=89845dcd8080cc91'
at ScriptSqlConfig.Program.ScriptInstance(String server, String directory)
at ScriptSqlConfig.Program.Main(String[] args)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].

EddyW Apr 20, 2012 at 11:22 PM 
Adding Users and Groups is NICE!
Thanks for incuding this in the update

gbargsle Apr 3, 2012 at 5:26 PM 
I think I found a bug. I ran the exe and my output for Logins contains a special character. The output file has (Corp – IS) as the user and it should be (Corp - IS). Not sure if the .NET is interpreting characters incorrectly or if SQL stores them differently.

EddyW Apr 11, 2011 at 8:13 PM 
A great start to this tool! Downloaded and running to check it out. Users and Groups would be nice.

mz1313 Apr 10, 2011 at 2:51 PM 
Scripts for jobs contain "@schedule_uid=N'c8576cb9-a455-4894-9ad6-b1734d004d67'" row (example) which should be just omitted - job scheduling GUIDs are usually different between servers unless you restore msdb on DR from backup of the original server.