I am trying to get the sys.dm_db_index_usage_stats from SMO with powershell script. Currently script looks like this:
[system.reflection.assembly]::LoadWithPartialName("Microsoft.SQLServer.Smo") | out-null
$SQLServer = "name"
$srv = new-object ("Microsoft.SqlServer.Management.Smo.Server") $SQLServer
$srv.Databases[‘master’].views | Select name
This way it prints all the available metrics. sys.dm_db_index_usage_stats is among them. But how do I get the value of sys.dm_db_index_usage_stats? Please advice