abhrfh 21 Reputation points

hi All

Need help. I am fairly new to Powershell. I am looking for a PowerShell script that scans all SQL servers on the network or the domain and searches for a particular user/login.
We are busy with an audit and there are three accounts that no one has a recollection of and we would like to disable these accounts.

Thank you in advance.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,891 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Purna Chandra Rao Chamidisetty 21 Reputation points

    @abhrfh - You can install SQL PowerShell module and try to connect SQL server to scan user logins. You may need to write some lines of code to achieve your objective

    0 comments No comments

  2. Clément 76 Reputation points


    You can start with this nice script I found on https://www.sqlservercentral.com/blogs/list-out-all-the-sql-servers-in-domain

    It does scan the SQL servers on a domain. The script could be upgraded to find the type of users/login you are looking for.

    0 comments No comments