$results = @() $MachineObject = new-object ('Microsoft.SqlServer.Management.Smo.WMI.ManagedComputer') . foreach ($instance in $MachineObject.ServerInstances) { $return = '' | select Instance, Port $return.Instance = $instance.name $return.Port = $instance.ServerProtocols['Tcp'].IPAddresses['IPAll'].IPAddressProperties['TcpPort'].Value $results += $return } $results | format-table
Don't run with scissors.
No comments:
Post a Comment