Best Practice: It is recommended to use -NoProfile parameter when executing scripts.
powershell.exe -NoProfile –File "C:\scripts\Get-DiskSpace.ps1"
Explanation:
When you run a script via scheduled task or via a shortcut, PowerShell will first load profiles and then run the script.
You never know what contains these profiles, so it can be dangerous and you can have unexpected behaviors.
NoProfile : Does not load the Windows PowerShell profile.
Note: To see all the available parameters : powershell.exe /?