Powershell

abhrfh 21 Reputation points
2021-09-28T07:51:42.753+00:00

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.
5,359 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Purna Rao 26 Reputation points
    2021-11-11T18:07:02.693+00:00

    @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
    2022-10-02T21:05:39.117+00:00

    Hi,

    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