i put simple try/catch around the:
$appPools = Get-WMIObject -Namespace "root/MicrosoftIISv2" -Class "IIsApplicationPoolSetting" -ErrorAction SilentlyContinue | Select-Object WAMUserName, WAMUserPass
this will now will run successfully with SP2019/Windows 2019.
i put simple try/catch around the: $appPools = Get-WMIObject -Namespace "root/MicrosoftIISv2" -Class "IIsApplicationPoolSetting" -ErrorAction SilentlyContinue | Select-Object WAMUserName, WAMUserPass this will now will run successfully with SP2019/Windows 2019.