I want to script my remote MS SQL database to local .sql files. I found correct powershell script which resolved my conception: link to GitHub). I have only one problem – the script works fine only on local machine with local credentials. To database can be connect both options username or local windows credentials.
As below is part of this script:
Well, you've got a bit happening. For starters, LoadWithPartialName() is deprecated; you really should be using Add-Type to load assemblies. Other than that, this isn't really a PowerShell question – you're using "raw" .NET. I mention that only because a developer site like StackOverflow might get you a better answer, but I'll give it a shot.