Quantcast
Channel: PowerShell Magazine » SMO
Browsing all 41 articles
Browse latest View live

#PSTip Failing over a mirrored SQL database using SMO

Note: This tip requires PowerShell 2.0 or above. After I configure SQL mirroring, I usually perform some checks to ensure that the overall mirroring configuration is working fine. This is an essential...

View Article



#PSTip Verify if a SQL database is mirrored or not

Note: This tip requires PowerShell 2.0 or above. When using SQL SMO to work with mirroring configuration, it is essential to verify if the database is mirrored, or not, before performing any other...

View Article

#PSTip List SQL database mirroring partner using SMO

Note: This tip requires PowerShell 2.0 or above. In an earlier tip, we looked at how to verify if a SQL database is mirrored. Continuing this series on SQL SMO tips series, let us look at how we can...

View Article

#PSTip Adding local users to SQL Server Logins using SMO

Note: This tip requires PowerShell 2.0 or above. There was a question on StackOverflow about adding local users to SQL … [visit site to read more]

View Article

#PSTip Retrieving SQL database last backup dates using SMO

Note: This tip requires PowerShell 2.0 or above. For regular reporting and auditing purposes, it is always desired to capture the SQL last backup dates. SQL SMO database properties give... Read more »

View Article


#PSTip List all endpoints in a SQL deployment

Note: This tip requires PowerShell 2.0 or above. When working with SQL Server database mirroring, it is desired to understand how to create and troubleshoot database endpoints. As with many other...

View Article

#PSTip Check if a SQL endpoint exists or not

Note: This tip requires PowerShell 2.0 or above. Before we make an attempt at creating a new database mirroring endpoint, we need to verify if an endpoint with … [visit site to read more]

View Article

#PSTip Creating a SQL TCP mirroring endpoint with SMO and PowerShell

Note: This tip requires PowerShell 2.0 or above. In today’s tip, we will see how we can use PowerShell and SMO to create a SQL TCP mirroring endpoint. We can use the visit site to read more]

View Article


#PSTip Deleting a SQL mirroring endpoint with SMO and PowerShell

Note: This tip requires PowerShell 2.0 or above. In earlier tips, we looked at how we can get all SQL endpoints, check if … [visit site to read more]

View Article


#PSTip Change database recovery model using SMO

Note: This tip requires PowerShell 2.0 or above. Database mirroring requires that the database be in Full recovery model as a prerequisite to configure mirroring. In this post, we shall see how we can...

View Article

#PSTip Get Active Database Connections of a SQL Database

Note: This tip requires PowerShell 2.0 or above. As a part of SQL SMO automation, when we want to detach or delete databases, we might want to first drop all active database connections. But how do we...

View Article

#PSTip Drop all Active Connections of SQL Database

Note: This tip requires PowerShell 2.0 or above. In an earlier tip, we looked at how we can retrieve the active … [visit site to read more]

View Article

#PSTip Add a SQL login to database roles using SMO

Note: This tip requires PowerShell 2.0 or above. We can use SQL Server SMO object to add a SQL login to the database roles. For example, roles such as dbcreator, sysadmin, etc. Let us see how we can do...

View Article


#PSTip Validate if a SQL login exists using PowerShell

Note: This tip requires PowerShell 3.0 or above. Before performing tasks like adding roles to a SQL login, it is desired to validate the existence of SQL login. This can be done using the Server SMO....

View Article

#PSTip Finding all databases to which a login is mapped

Note: This tip requires PowerShell 2.0 or above. One of the projects on which I work requires a validation step after each deployment. We need to validate if the logins have been mapped to all required...

View Article


#PSTip Finding all roles a particular login is mapped to in all databases

Note: This tip requires PowerShell 2.0 or above. In a previous tip, we checked out how to get the names of all … [visit site to read more]

View Article

#PSTip Validate is a database is available on a SQL instance

Note: This tip requires PowerShell 2.0 or above. Sometimes we need to know if a particular DB is available on a given instance before going ahead and making any configuration changes. The below code...

View Article


#PSTip Creating extended properties on database objects using SMO

Note: This tip requires PowerShell 2.0 or above. You might have seen several articles on the web discussing about the SQL database extended properties from a self-documentation point of view. I believe...

View Article

#PSTip Reading extended properties on database objects using SMO

Note: This tip requires PowerShell 2.0 or above. Extended properties are an useful but, under utilized feature in SQL server. In an visit site to read more]

View Article

#PSTip Updating extended properties on database objects using SMO

Note: This tip requires PowerShell 2.0 or above. In an earlier tip, we saw how we can read extended … [visit site to read more]

View Article
Browsing all 41 articles
Browse latest View live




Latest Images