2026-11-26

scom

 [cmd title="Administrator: Windows PowerShell"] 


$reg = Get-ItemProperty "HKLM:SOFTWARE\Microsoft\System Center\2010\Common\Database"
$cs  = "Server=$($reg.DatabaseServerName);Database=$($reg.DatabaseName);Trusted_Connection=True;"
$c   = New-Object System.Data.SqlClient.SqlConnection $cs
$c.Open()
$cmd = $c.CreateCommand()
$cmd.CommandText = "SELECT COUNT(*) AS Total,
                           SUM(CASE WHEN Data IS NOT NULL AND UserName IS NOT NULL THEN 1 ELSE 0 END) AS Usable
                    FROM dbo.CredentialManagerSecureStorage;"
$r = $cmd.ExecuteReader(); $r.Read()
"Total rows : {0}" -f $r['Total']
"Usable rows: {0}" -f $r['Usable']
$c.Close()
 

 

[/cmd]

Share this post

0 comments

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

© 2009 Start With Linux | Mannu Linux
Designed by cyb3r.gladiat0r
Posts RSS ∙ Comments RSS
Back to top