A module-level variable is declared outside functions and shared by code inside a PowerShell module. It is useful for reusable configuration, such as a database connection string, across several functions. section 26.3
Use module scope deliberately:
- Export the variable when callers need it; loading the module adds it to the global scope, and unloading removes it. section 26.3
- Leave helper functions unexported when they support the module internally rather than providing a public command. section 26.3
Connection-string configuration
A disk-information module stores its SQL Server connection string in $DiskInfoSqlConnection. New-DiskInfoSQLTable reuses that value to open the connection and create the diskinfo table when it does not already exist.
