Script for sql accessment

Vishu 1,736 Reputation points
2022-03-02T03:10:23.867+00:00

Hi Experts,

Can you please suggest a powershell script which can do some basic assessment of a onpremise sql server like version , edition , number and size of databases , whatever possible

SQL Server | Other
0 comments No comments
{count} votes

Accepted answer
  1. Olaf Helper 47,436 Reputation points
    2022-03-02T08:06:56.84+00:00

1 additional answer

Sort by: Most helpful
  1. YufeiShao-msft 7,146 Reputation points
    2022-03-02T06:45:45.263+00:00

    Hi @Vishu ,

    Here is a script that reads a .txt file that lists all my SQL servers and gets the file name, file path, file size, and size used for the data file (.mdf) and log file (.ldf) for each database on each server in the .txt file:
    https://www.mssqltips.com/sqlservertip/2698/use-powershell-to-gather-sql-server-database-physical-file-sizes/

    PowerShell do an Inventory of your Servers, about use PowerShell to gather SQL Server information such as edition, version, logins, databases, configuration and errors.

    https://www.red-gate.com/simple-talk/databases/sql-server/database-administration-sql-server/let-powershell-do-an-inventory-of-your-servers/#:~:text=We%20can%20also%2C%20via%20a%20Server%20Management%20Objects,SQL%20Server%20instances%2C%20and%20the%20databases%20they%20house.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.