I would use the replace powerhsell command.
there is a trim command in powershell but it removes leading and tailing spaces so not what we are after in this case
i usually do things "manually" first and then write the scripts
e.g.
$SHATHUMB = " 90 JF EF 83 DF"
$SHATHUM = $SHATHUMB.replace(" ","")
Write-Host($SHATHUMB)
will write this as a script later and integrate it with my certbot run
i believe for windows it will be a mix of python and powershell for a while as powershell has really good commandlets for doing windows related functions.
Andrei