When you want to read the script contained within a CM script, you will find the SCRIPT field is encoded and unreadable.
Use this to decode the script.
#Powershell code
(get-cmscript -ScriptName “script test” | select -Property script) |
foreach {[System.Text.Encoding]::unicode.GetString([System.Convert]::FromBase64String($_.script))}