>> I have a very simple script :
attrib -h c:\TrackitAudit.id 1>>\\10.65.0.11\report\%ComputerName%.txt
2>>&1
del c:\TrackitAudit.id 1>>\\10.65.0.11\report\%ComputerName%.txt 2>>&1
echo %date% %time% 1>>\\10.65.0.11\report\%ComputerName%.txt
>> If you can't tell, it will unhide the file, then delete it, then
>> report the time when it was last run.
[quoted text clipped - 21 lines]
>
> however, the file is still there.
You should be able to combine the first two lines by using the /AH
parameter on the DEL command - this should delete a hidden file without
you needing to do the ATTRIB to remove the hidden attribute first.
When the script runs, who is it running as (the current user, perhaps)?
For the script to work, this user will need write permissions to
\\10.65.0.11\report\%ComputerName%.txt
(as well as to c:\TrackitAudit.id, of course)
The default permissions often deny write access to anything in the root
of C:\ for non-admin users.
What happens if the user runs the script manually instead of you?
What happens if you remove the parts that log to %ComputerName%.txt?
Am I understanding correctly that the redirection of STDERR ( 2>>&1 )
makes it go to the same place as STDOUT, and since this is redirected to
the %Computername%.txt file, it goes there? I haven't used that before.
Tesdall - 26 Sep 2007 12:56 GMT
> >> I have a very simple script :
> >>
[quoted text clipped - 45 lines]
> makes it go to the same place as STDOUT, and since this is redirected to
> the %Computername%.txt file, it goes there? I haven't used that before.
If i understand this correctly im running this as a startup script not a
login script which then runs the script as local admin which should have no
problem reaching C:\ .
If a normal user runs the script it says (in the log) that the file can not
be found (even though im looking right at it) however, since i have admin
rights, that if i run it then it works fine.
The 1>>\\w2000srv2\report\%ComputerName%.txt 2>>&1 part of the script does
the following, it checks to see if there is a log.txt file for that
computername and if there is not one it makes one, if there is one it adds
more lines to it. The computername part of the code is just pretty much for
netbios labeling so it would make a test.txt if the computer was named test.
a - 26 Sep 2007 13:04 GMT
>> >> I have a very simple script :
>> >>
[quoted text clipped - 63 lines]
> just pretty much for netbios labeling so it would make a test.txt if
> the computer was named test.
I think that it actually runs as the SYSTEM account, not the
ADMINISTRATOR account. SYSTEM would have no access to the remote log
file (just like the regular user may have no access to it).
Try this as you, just to show you what may be happening:
VER (this should work)
VER >>C:\TEST (this should also work, writing result to C:\TEST)
VER >>Q:\TEST (where Q: does not exist - this will fail)
Tesdall - 27 Sep 2007 21:24 GMT
> >> >> I have a very simple script :
> >> >>
[quoted text clipped - 72 lines]
> VER >>C:\TEST (this should also work, writing result to C:\TEST)
> VER >>Q:\TEST (where Q: does not exist - this will fail)
You are correct i was thinking the local system admin however its just local
system account. I may just have to make the file del -h c:\trackitaudit.id
and thats it.