Command works in Powershell but not in PSADT

try running PSADT from an elevated open PS console.
If errors occur, you see them on the console but they won’t be logged.

If you want to log the errors from your lines, look here: How to Log built-in PowerShell commands (non-PSADT commands)