Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > accesschk script to include datestamp

Reply
Thread Tools Display Modes

accesschk script to include datestamp

 
 
Altria
Guest
Posts: n/a

 
      11-13-2008
Hello All,
I would like to automate a daily report of accesschk againsts a file server
but would like to include a datestamp, for example;

accesschk -rws "group" "folder target" > %datestamp%.txt

I would like afterwards to run a diff command (what is the equivalent of
this in windows?) against the files and see if any access permissions have
changed

Any help would be greatly appreciated!

Thanks,
Altria


 
Reply With Quote
 
 
 
 
Altria
Guest
Posts: n/a

 
      11-13-2008
Tom thanks for your fast reply!
That is exactly what I needed.

For the second question would it be more complicated to have the file
compare utility do a condition process whereby if changes between files are
found it would send an email?
Or would I need something much more involeved to get that kind of
automation?

Thanks again,
Altria
"Tom Lavedas" <> wrote in message
news:2f5dbee6-66ca-4493-ae95-...
On Nov 13, 9:44 am, "Altria" <urbante...@msn.com> wrote:
> Hello All,
> I would like to automate a daily report of accesschk againsts a file
> server
> but would like to include a datestamp, for example;
>
> accesschk -rws "group" "folder target" > %datestamp%.txt
>
> I would like afterwards to run a diff command (what is the equivalent of
> this in windows?) against the files and see if any access permissions have
> changed
>
> Any help would be greatly appreciated!
>
> Thanks,
> Altria


Try something like this to get a datestamp ...

for %%a in (%date%) do set datestamp=%%a
set datestamp=%datestamp:/=%
accesschk -rws "group" "folder target" > %datestamp%.txt

It creates a date stamp in a form of ddmmyyyy in the US or mm-dd-yyyy
elsewere. A more 'sortable' date stamp requires significantly more
code. Handling dates, in general, is locale dependent, which can
complicate explaining how to get one in batch. It's a bit easier in
WinScript, but that seems to be off topic.

The other question about comparing file contents can be done with the
FC (file compare) utility. For example (in XP), ...

fc file1.txt file2.txt > nul
if not errorlevel 1 (
echo Files are identical
) else (
echo Files are different
)

Tom Lavedas
***********
http://there.is.no.more/tglbatch/


 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      11-13-2008
Building on Tom's code:
fc file1.txt file2.txt > nul
if not errorlevel 1 (
echo Files are identical
) else (
blat /.. /..
)

blat.exe is a Command Line mailer that you can download from a number of
sites. You could also use a VB Script mailer but since you're running a
batch file there seems to be little point in moving to a hybrid solution.


"Altria" <> wrote in message
news:%...
> Tom thanks for your fast reply!
> That is exactly what I needed.
>
> For the second question would it be more complicated to have the file
> compare utility do a condition process whereby if changes between files
> are found it would send an email?
> Or would I need something much more involeved to get that kind of
> automation?
>
> Thanks again,
> Altria
> "Tom Lavedas" <> wrote in message
> news:2f5dbee6-66ca-4493-ae95-...
> On Nov 13, 9:44 am, "Altria" <urbante...@msn.com> wrote:
>> Hello All,
>> I would like to automate a daily report of accesschk againsts a file
>> server
>> but would like to include a datestamp, for example;
>>
>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>
>> I would like afterwards to run a diff command (what is the equivalent of
>> this in windows?) against the files and see if any access permissions
>> have
>> changed
>>
>> Any help would be greatly appreciated!
>>
>> Thanks,
>> Altria

>
> Try something like this to get a datestamp ...
>
> for %%a in (%date%) do set datestamp=%%a
> set datestamp=%datestamp:/=%
> accesschk -rws "group" "folder target" > %datestamp%.txt
>
> It creates a date stamp in a form of ddmmyyyy in the US or mm-dd-yyyy
> elsewere. A more 'sortable' date stamp requires significantly more
> code. Handling dates, in general, is locale dependent, which can
> complicate explaining how to get one in batch. It's a bit easier in
> WinScript, but that seems to be off topic.
>
> The other question about comparing file contents can be done with the
> FC (file compare) utility. For example (in XP), ...
>
> fc file1.txt file2.txt > nul
> if not errorlevel 1 (
> echo Files are identical
> ) else (
> echo Files are different
> )
>
> Tom Lavedas
> ***********
> http://there.is.no.more/tglbatch/
>



 
Reply With Quote
 
Altria
Guest
Posts: n/a

 
      11-13-2008
Thank you Pegasus!
Actually another question then would be do you think that the accesschk is
the best way of capturing and automating this information. Is there a better
way and simpler way via vbscript, perl,python etc.?

Thanks again,
Altria
"Pegasus (MVP)" <> wrote in message
news:...
> Building on Tom's code:
> fc file1.txt file2.txt > nul
> if not errorlevel 1 (
> echo Files are identical
> ) else (
> blat /.. /..
> )
>
> blat.exe is a Command Line mailer that you can download from a number of
> sites. You could also use a VB Script mailer but since you're running a
> batch file there seems to be little point in moving to a hybrid solution.
>
>
> "Altria" <> wrote in message
> news:%...
>> Tom thanks for your fast reply!
>> That is exactly what I needed.
>>
>> For the second question would it be more complicated to have the file
>> compare utility do a condition process whereby if changes between files
>> are found it would send an email?
>> Or would I need something much more involeved to get that kind of
>> automation?
>>
>> Thanks again,
>> Altria
>> "Tom Lavedas" <> wrote in message
>> news:2f5dbee6-66ca-4493-ae95-...
>> On Nov 13, 9:44 am, "Altria" <urbante...@msn.com> wrote:
>>> Hello All,
>>> I would like to automate a daily report of accesschk againsts a file
>>> server
>>> but would like to include a datestamp, for example;
>>>
>>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>>
>>> I would like afterwards to run a diff command (what is the equivalent of
>>> this in windows?) against the files and see if any access permissions
>>> have
>>> changed
>>>
>>> Any help would be greatly appreciated!
>>>
>>> Thanks,
>>> Altria

>>
>> Try something like this to get a datestamp ...
>>
>> for %%a in (%date%) do set datestamp=%%a
>> set datestamp=%datestamp:/=%
>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>
>> It creates a date stamp in a form of ddmmyyyy in the US or mm-dd-yyyy
>> elsewere. A more 'sortable' date stamp requires significantly more
>> code. Handling dates, in general, is locale dependent, which can
>> complicate explaining how to get one in batch. It's a bit easier in
>> WinScript, but that seems to be off topic.
>>
>> The other question about comparing file contents can be done with the
>> FC (file compare) utility. For example (in XP), ...
>>
>> fc file1.txt file2.txt > nul
>> if not errorlevel 1 (
>> echo Files are identical
>> ) else (
>> echo Files are different
>> )
>>
>> Tom Lavedas
>> ***********
>> http://there.is.no.more/tglbatch/
>>

>
>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      11-13-2008
Sorry, I know nothing about accesschk and what it does.


"Altria" <> wrote in message
news:...
> Thank you Pegasus!
> Actually another question then would be do you think that the accesschk is
> the best way of capturing and automating this information. Is there a
> better way and simpler way via vbscript, perl,python etc.?
>
> Thanks again,
> Altria
> "Pegasus (MVP)" <> wrote in message
> news:...
>> Building on Tom's code:
>> fc file1.txt file2.txt > nul
>> if not errorlevel 1 (
>> echo Files are identical
>> ) else (
>> blat /.. /..
>> )
>>
>> blat.exe is a Command Line mailer that you can download from a number of
>> sites. You could also use a VB Script mailer but since you're running a
>> batch file there seems to be little point in moving to a hybrid solution.
>>
>>
>> "Altria" <> wrote in message
>> news:%...
>>> Tom thanks for your fast reply!
>>> That is exactly what I needed.
>>>
>>> For the second question would it be more complicated to have the file
>>> compare utility do a condition process whereby if changes between files
>>> are found it would send an email?
>>> Or would I need something much more involeved to get that kind of
>>> automation?
>>>
>>> Thanks again,
>>> Altria
>>> "Tom Lavedas" <> wrote in message
>>> news:2f5dbee6-66ca-4493-ae95-...
>>> On Nov 13, 9:44 am, "Altria" <urbante...@msn.com> wrote:
>>>> Hello All,
>>>> I would like to automate a daily report of accesschk againsts a file
>>>> server
>>>> but would like to include a datestamp, for example;
>>>>
>>>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>>>
>>>> I would like afterwards to run a diff command (what is the equivalent
>>>> of
>>>> this in windows?) against the files and see if any access permissions
>>>> have
>>>> changed
>>>>
>>>> Any help would be greatly appreciated!
>>>>
>>>> Thanks,
>>>> Altria
>>>
>>> Try something like this to get a datestamp ...
>>>
>>> for %%a in (%date%) do set datestamp=%%a
>>> set datestamp=%datestamp:/=%
>>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>>
>>> It creates a date stamp in a form of ddmmyyyy in the US or mm-dd-yyyy
>>> elsewere. A more 'sortable' date stamp requires significantly more
>>> code. Handling dates, in general, is locale dependent, which can
>>> complicate explaining how to get one in batch. It's a bit easier in
>>> WinScript, but that seems to be off topic.
>>>
>>> The other question about comparing file contents can be done with the
>>> FC (file compare) utility. For example (in XP), ...
>>>
>>> fc file1.txt file2.txt > nul
>>> if not errorlevel 1 (
>>> echo Files are identical
>>> ) else (
>>> echo Files are different
>>> )
>>>
>>> Tom Lavedas
>>> ***********
>>> http://there.is.no.more/tglbatch/
>>>

>>
>>

>
>



 
Reply With Quote
 
Altria
Guest
Posts: n/a

 
      11-17-2008
Accesschk is by sysinternals (MS) and allows you to enumerate access
permissions of a group or user to a folder or files on the system. It is
command-line based and is similar to the GUI equivalent which accessenum

The problem with these utilities is that they are very general. What if I
wanted a specific user or more than one but not a group, I am unable to do
this. That is why I was curious to know if there was a "preferred" method of
obtaining and tracking access rights to shares?

Thanks,
Altria
"Pegasus (MVP)" <> wrote in message
news:...
> Sorry, I know nothing about accesschk and what it does.
>
>
> "Altria" <> wrote in message
> news:...
>> Thank you Pegasus!
>> Actually another question then would be do you think that the accesschk
>> is the best way of capturing and automating this information. Is there a
>> better way and simpler way via vbscript, perl,python etc.?
>>
>> Thanks again,
>> Altria
>> "Pegasus (MVP)" <> wrote in message
>> news:...
>>> Building on Tom's code:
>>> fc file1.txt file2.txt > nul
>>> if not errorlevel 1 (
>>> echo Files are identical
>>> ) else (
>>> blat /.. /..
>>> )
>>>
>>> blat.exe is a Command Line mailer that you can download from a number of
>>> sites. You could also use a VB Script mailer but since you're running a
>>> batch file there seems to be little point in moving to a hybrid
>>> solution.
>>>
>>>
>>> "Altria" <> wrote in message
>>> news:%...
>>>> Tom thanks for your fast reply!
>>>> That is exactly what I needed.
>>>>
>>>> For the second question would it be more complicated to have the file
>>>> compare utility do a condition process whereby if changes between files
>>>> are found it would send an email?
>>>> Or would I need something much more involeved to get that kind of
>>>> automation?
>>>>
>>>> Thanks again,
>>>> Altria
>>>> "Tom Lavedas" <> wrote in message
>>>> news:2f5dbee6-66ca-4493-ae95-...
>>>> On Nov 13, 9:44 am, "Altria" <urbante...@msn.com> wrote:
>>>>> Hello All,
>>>>> I would like to automate a daily report of accesschk againsts a file
>>>>> server
>>>>> but would like to include a datestamp, for example;
>>>>>
>>>>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>>>>
>>>>> I would like afterwards to run a diff command (what is the equivalent
>>>>> of
>>>>> this in windows?) against the files and see if any access permissions
>>>>> have
>>>>> changed
>>>>>
>>>>> Any help would be greatly appreciated!
>>>>>
>>>>> Thanks,
>>>>> Altria
>>>>
>>>> Try something like this to get a datestamp ...
>>>>
>>>> for %%a in (%date%) do set datestamp=%%a
>>>> set datestamp=%datestamp:/=%
>>>> accesschk -rws "group" "folder target" > %datestamp%.txt
>>>>
>>>> It creates a date stamp in a form of ddmmyyyy in the US or mm-dd-yyyy
>>>> elsewere. A more 'sortable' date stamp requires significantly more
>>>> code. Handling dates, in general, is locale dependent, which can
>>>> complicate explaining how to get one in batch. It's a bit easier in
>>>> WinScript, but that seems to be off topic.
>>>>
>>>> The other question about comparing file contents can be done with the
>>>> FC (file compare) utility. For example (in XP), ...
>>>>
>>>> fc file1.txt file2.txt > nul
>>>> if not errorlevel 1 (
>>>> echo Files are identical
>>>> ) else (
>>>> echo Files are different
>>>> )
>>>>
>>>> Tom Lavedas
>>>> ***********
>>>> http://there.is.no.more/tglbatch/
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
include Bcc FireBrick Windows Vista Mail 4 08-03-2008 10:10 PM
How to include wdm.h and ks.h in one file David Windows Vista Drivers 1 09-21-2007 04:28 AM
Address BCBA5BD0 base at BCB68000 DateStamp 402816ae Savrt.sys Line Andersen Windows Update 1 01-05-2005 01:27 PM
Using include and Need in .inf for Win XP Stefan Levie Windows Vista Drivers 4 11-11-2003 06:19 PM
include username and password in logon script Simon Scripting 1 07-02-2003 06:20 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59