Invoke-SCXDiscovery cmdlet need to support referencing SCOM RunAs accounts
Currently there is no way to leverage a built in RunAs account that is pre-configured in SCOM to use Invoke-SCXDiscovery cmdlet, while it is possible to reference that when pushing an agent via the console. Inability to rely on SCOM RunAs accounts requires keeping another copy of the credentials together with the script, which in turn adds some overhead with regards to keeping those creds secure and in consistence with the SCOM store.
Vladimir Zelenov commented
You can use this script as workaround to get credentials - https://www.powershellgallery.com/packages/RunAsAccount/1.0.3/Content/RunAsAccount.psm1