Database Migration Assistant and PowerShell

  • I'm trying to use PowerShell to analyze the DMA JSON files, but I'm getting some odd behavior and don't know PS well enough to resolve all the issues.

    I've been able to create a PS object from the file using this

    $jsonObj = Get-Content $InputFileName | ConvertFrom-Json

    And I can return elements I need thus:

    $jsonDBList = $jsonObj.Databases|select ServerName, name, CompatibilityLevel 
    $jsonDBList

    $jsonRecomend = $jsonObj.Databases.AssessmentRecommendations| select CompatibilityLevel, Title, Severity
    $jsonRecomend

    but I can't relate the various levels - Server Level, Database Level, Object Level, with the recommendation level or get an output something like:

    SQLServerName, ServerVersion, DBName, DatabaseCompatibility, AssessmentCompatLevel, AssesmentSeverity, AssesmentTitle, ImpactedObjectName, ImpactedObjectType, etc. Essentially creating a table that could be put into a document with minimal manual editing.

    Also I've found that if I run the DBList and Recomend commands as above, the 2nd one sometimes won't return all elements, even though individually they always work.

    Does anyone know of a site that has PS code or information on how best to do this?

     

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • I've resolved the problem of some commands not returning all elements. I'm now using:

    $jsonDBList = $jsonObj.Databases|select ServerName, name, CompatibilityLevel | Format-Table

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply