Monthly Archives: March 2016

PowerShell – Getting All Running SQL Services

Getting all SQL Server services running on a server using PowerShell: Get-WmiObject -Class sqlservice -Namespace “ROOT\Microsoft\SqlServer\ComputerManagement11” | Select ServiceName Additionally, this can be set to an array and worked with as such. $services = Get-WmiObject -Class sqlservice -Namespace “ROOT\Microsoft\SqlServer\ComputerManagement11” | Select ServiceName foreach($service in $services) { $service.ServiceName } $services[0].ServiceName >> MSSQLSERVER $services[1].ServiceName >> SQLBrowser $services[2].ServiceName… Read More »

SQL Server Compare Users Script

If you need to compare two users in SQL Server, here is a handy script. The output is simply a script to make the “UserToChange” sync up with the “ModelUser”. So this script generates a script.