I have moved a windows script to a new machine running Windows Server 2008 R2 (from a machine running 2000).
The first thing the script does is rename a text file in the same folder as the script.
The file in question has the currently logged in user (which is an administrator) in it's security list with 'full control' set.
When I try to run the script by double clicking it (while logged into the machine as the same administrator with full control of the file) I get 'access denied' for the line where the file is renamed.
If I run the script via a scheduled task it can get beyond that point.
If I run the script indirectly via the 'runas' command running as 'Administrator' it gets past that point.
So it seems like Windows is simply ignoring the rights that the domain admin account has on the file.
Incedentally I also can't save any changes to the script file, I get access denied for that too.
Any idea how to stop the OS from ignoring the rights that the logged in user has on the files?
Edit: in response to Gnouc's comment I have taken ownership of the folder that contains the script and the other file the script is trying to rename. It now works. So it seems like for a script to work properly the user running the script needs to have 'full control' AND be the owner! Seems a bit restrictive, but I guess someone could argue that it's the OS being more secure.