我使用以下方法提取了 SQL 实例的一些详细信息:
$SQLInstance1 = Get-DbaInstanceProperty -SqlInstance SQL | Select-Object ComputerName, Name, Value | Where-Object Name -In ("FullyQualifiedNetName", "Edition", "PhysicalMemory", "Processors", "VersionString", "Collation", "IsClustered", "ResourceLastUpdateDateTime")
将这些值分配给数组输出中的变量的最佳方法是什么,如下所示:
计算机名称 名称 值
SQL Edition Enterprise Edition(64 位) SQL PhysicalMemory 1571485
SQL Processors 40
SQL VersionString 11.0.7493.4
SQL Collation Latin1_General_CI_AS
SQL IsClustered True
SQL ResourceLastUpdateDateTime 24/12/2019 9:58:55 PM
SQL FullyQualifiedNetName PTHSQL13.FMG.local
所以我想从上面分配$ComputerName = ComputerName
等$Edition = Edition
,然后我可以用它来更新 SQL 表$ComputerName