Management Studio -> Tasks -> Generate Script

  • Is there any way to run this via command line or at least change the default options such as setting logins and permissions to TRUE? Is this doable in the registry somewhere?

    I looked at sqlpubwiz, but it does not do logins and database creation. I saw SQL-Scripter, but this more for data movement.

    I have around 100 databases that I need to do.

  • You can set permissions to default to true in SSMS - Tools -> Options -> SQL Server Object Explorer -> Scripting

    But I can't see Logins there.

    Think Powershell will be your friend here - there's an article from Phil Factor here[/url] that'll be much more use to you than I can be.

    I'm also not 100% sure, but I think non-Windows logins will be created with nonsense passwords when scripting via this method.

    Cheers

  • Concurring with Gazareth here; if the logins need to be migrated, you need to use sp_help_revlogin , which will maintain the password in an encrypted binary string so it can be recreated on another machine. using anything else, and you cannot get the passwords, so a static string or junk/new password would get created instead.

    How to transfer logins and passwords between instances of SQL Server

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply