• Great script. Have a quick question, I'm trying to use this script to generate schema dumps of a remote database instance. I do not have and it will take too long to get admin rights to allow executing powershell scripts on the machine where the databases lie. I can connect to the database server just fine from my remote machine, and I tried modifying your script to allow using mixed-mode authentication, but I keep getting the following error:

    The following exception was thrown when trying to enumerate the collection: "Failed to connect to server 192.168.45.91\DYNSQLEX.".

    At F:\Projects\paxomas_wlds\branches\Projects\Scripts\powershell\auto-dump.ps1:123 char:10

    + foreach <<<< ($login in $server.Logins)

    + CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException

    + FullyQualifiedErrorId : ExceptionInGetEnumerator

    The lines I added:

    #This sets the connection to mixed-mode authentication

    $server.ConnectionContext.LoginSecure=$false;

    #This sets the login username

    $server.ConnectionContext.set_Login("dynamic_gwy")

    #This sets the login password

    $server.ConnectionContext.set_Password("VchK6Yd7V6YPN#k")

    This is my first attempt at using PowerShell. What if anything am I missing, and does this script generate insert statements for data for all the tables in all the databases?