Private/Local/Formatters.ps1
function Format-Json([Parameter(Mandatory, ValueFromPipeline)][String] $json) { $indent = 0; ($json -Split '\n' | ForEach-Object { if ($_ -match '[\}\]]') { # This line contains ] or }, decrement the indentation level $indent-- } $line = (' ' * $indent * 2) + $_.TrimStart().Replace(': ', ': ') if ($_ -match '[\{\[]') { # This line contains [ or {, increment the indentation level $indent++ } $line }) -Join "`n" } <# .SYNOPSIS Converts a registry type string to a human readable string. .PARAMETER type The registry type string to convert. #> function ConvertTo-RegistryTypeString { param ( [Parameter(Mandatory, ValueFromPipeline)][String] $type ) switch ($type) { "Reg_SZ" { return "String" } "Reg_DWORD" { return "DWord" } "Reg_QWORD" { return "QWord" } "Reg_EXPAND_SZ" { return "ExpandString" } "Reg_MULTI_SZ" { return "MultiString" } "Reg_BINARY" { return "Binary" } default { return "Unknown" } } } # SIG # Begin signature block # MIIFWwYJKoZIhvcNAQcCoIIFTDCCBUgCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUEOhjTcpPtLqngYN87ZMOpr1j # XpigggL2MIIC8jCCAdqgAwIBAgIQYseIafgwqaZNeZ4d0CYhxTANBgkqhkiG9w0B # AQsFADAaMRgwFgYDVQQDEw9LZXZpbiBLdmlzc2JlcmcwHhcNMjMxMjE4MjMxODA0 # WhcNMjQxMjE4MDUxODA0WjAaMRgwFgYDVQQDEw9LZXZpbiBLdmlzc2JlcmcwggEi # MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDKlNjwOPiKcBJ86HgpMe6dojbh # 8stpdYz+D9rLchQwSVRLJkay4McHeETdeUTRPgqVZfnt3ExwJpQoEwKw3mKcU+xe # OQfODBAURPneH6AU774u2es3/qfIWITlW423s4DInw4X1LC4wblD59fnprfF1MpA # ZvouL+NndDlDjf8JRvHL3XgaD9niT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