Fix Powershell related SonarCloud warnings (#10899)