Is the scheduled task using your credential or the default SYSTEM user?
The SYSTEM account, when authenticating, uses the name of your machine (e.g., COMPUTER$) but doesn't provide a password.
You should be including error handling in your scripts (and sometimes transcriptions) and recording any errors the script encounters. Without knowing why something doesn't (or didn't) works without knowing why it failed will lead to very lengthy debugging sessions.