If you can't get the Systinternals SDelete utility to run automatically, check that the EULA has been accepted by the user.
So, I was trying to setup an automatic backup script for the computers at Immanuel Bible Church, and was having an extremely difficult time figuring out why they would always hang and not complete. The problem was, the script would run just fine when I ran it from a command prompt, it was only when it was run from the Scheduled Tasks editor that it would hang. I finally tracked the problem down to when it tried to run sDelete to securely delete the temporary files that it copied when making the backup. However, I didn't get any debugging information from sDelete in the logfile, in fact it didn't print out anything.
After banging my head against the wall for several hours I finally posted a question on the Sysinternals Forum with my problem. As it turns out, the first time that sDelete is run under a users account, it pops up a dialog box with the EULA asking them to accept it. That's not a big deal normally, the user clicks "Accept" and the program continues running. However, I was running the automatic backups under the NT AUTHORITY\SYSTEM account which hadn't accepted the EULA, and Windows didn't display the dialog box.
The solution turns out be pretty simple. When a user accepts the EULA, sDelete writes a registry key to that effect in that user's hive. For the NT AUTHORITY\SYSTEM account, that key is under HKEY_USERS\.Default\Software\Sysinternals\SDelete. SDelete then checks for that key and if it exists it continues running, otherwise it waits for the user to accept the EULA. So by running the following command, all one line, during my install script I was able to solve the problem.
reg add HKU\.Default\Software\Sysinternals\SDelete /v "EulaAccepted" /t REG_DWORD /d 0x01 /f