Running cron as administrator or another user in Drupal

Here are some links and notes about cron on Drupal 6. When you let the server run cron on your Drupal installation it runs as Anonymous user (uid=0) and if you have some tasks that requires admin access it will leave those. One workaround is to temporary fake another user, like it was admin (uid=1) who run the cronjob.

This is a safer way to temporary change the user because if the function crashes it has not saved the temporary user. If the function succeed it returns to Anonymous user when finished.