How it works...
The first database name is being assigned to a variable named $SQLServer. In this case, hqdbt01 is assigned to the variable. Then, create an instance of the object using the Microsoft.SqlServer.Management.Smo.Server namespace. In the next step, set the object properties based on the authentication type. In this case, the Windows SQL instance is being accessed using mixed-mode authentication. So, set the ConnectionContext.loginsecure property of the Server object to $false. This enables the SQL Server to use mixed-mode authentication. This is creating child objects for the parent-object Server property. You'll need to explicitly specify the username and password to build the connection. After logging in using the username and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access