Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Writing to a Log file

Reply
Thread Tools Display Modes

Re: Writing to a Log file

 
 
Mike 'Spike' Lovell
Guest
Posts: n/a

 
      10-21-2009
> I have a batch file that runs a WMI command to do an IIS Reset on a
> remote machine. When it's doing it, I want it to log the date/time that
> the reset is done, but I'm having trouble getting it to work. Probably
> an issue with my syntax. Here is my code:
>
> wmic /node:"sup24app01" process call create "cmd /k date /t >
> c:\maintenance\iis_reset_log.txt
> wmic /node:"sup24app01" process call create "cmd /k iisreset
>
> I'm not sure what I'm doing wrong, but the file doesn't get created
> and, all I want is to append the date/time stamp within the contencts of
> the file.


date will wait for user input, you can do this:

echo %date% %time% >> <filename>

(use two ">" which means append, otherwise you'll only see the last time it
happened)

~ Mike

 
Reply With Quote
 
 
 
 
Al Dunbar
Guest
Posts: n/a

 
      10-21-2009


"Mike 'Spike' Lovell" <> wrote in
message news:...
>> I have a batch file that runs a WMI command to do an IIS Reset on a
>> remote machine. When it's doing it, I want it to log the date/time that
>> the reset is done, but I'm having trouble getting it to work. Probably
>> an issue with my syntax. Here is my code:
>>
>> wmic /node:"sup24app01" process call create "cmd /k date /t >
>> c:\maintenance\iis_reset_log.txt
>> wmic /node:"sup24app01" process call create "cmd /k iisreset
>>
>> I'm not sure what I'm doing wrong, but the file doesn't get created
>> and, all I want is to append the date/time stamp within the contencts of
>> the file.

>
> date will wait for user input,


not when used with the "/T" switch.

> you can do this:
>
> echo %date% %time% >> <filename>


Yes, he can do that - assuming he wants to log the date and time locally,
and wants the local time to be the time that is used. I thought he was
running the command remotely in order to have the remote time logged.

/Al



 
Reply With Quote
 
Mike 'Spike' Lovell
Guest
Posts: n/a

 
      10-22-2009
> not when used with the "/T" switch.

Which he wasn't doing ;o)

> Yes, he can do that - assuming he wants to log the date and time locally,
> and wants the local time to be the time that is used. I thought he was
> running the command remotely in order to have the remote time logged.


I don't understand what you're saying, "date" and the above echo - Both the
local time where they are run. He never mentioned any other requirement.

~ Mike

 
Reply With Quote
 
Al Dunbar
Guest
Posts: n/a

 
      10-22-2009

"Mike 'Spike' Lovell" <> wrote in
message news:...
>> not when used with the "/T" switch.

>
> Which he wasn't doing ;o)


Is that a "/t" following the word "date" in the first line?

wmic /node:"sup24app01" process call create "cmd /k date /t >
c:\maintenance\iis_reset_log.txt
wmic /node:"sup24app01" process call create "cmd /k iisreset

>> Yes, he can do that - assuming he wants to log the date and time locally,
>> and wants the local time to be the time that is used. I thought he was
>> running the command remotely in order to have the remote time logged.

>
> I don't understand what you're saying, "date" and the above echo - Both
> the local time where they are run. He never mentioned any other
> requirement.


He was perhaps not explicit, but since some of the remote machines he wants
to do an IIS Reset on might be located in another timezone, it is a
possibility I wouldn't discount.

/Al



 
Reply With Quote
 
Mike 'Spike' Lovell
Guest
Posts: n/a

 
      10-23-2009
> He was perhaps not explicit, but since some of the remote machines he
> wants to do an IIS Reset on might be located in another timezone, it is a
> possibility I wouldn't discount.


It's all a bit academic now! Looks like he's decided it was resolved
without posting so.

~ Mike

 
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
Push a HOSTS file via Group Policy Jeff Active Directory 5 10-21-2009 05:35 PM
ReadyBoost file will not open Papa z Windows Vista Hardware 1 07-15-2007 09:16 PM
Ultra 4 port USB Hub driver issue Walt Windows Vista Hardware 27 07-13-2007 10:56 AM
cloning laptop sata harddrive vista premium Mark Ryan Windows Vista Hardware 5 04-26-2007 06:44 PM
Re: Boot critical file is corrupt: ...\drivers\ecache.sys Zack Whittaker Windows Vista Hardware 3 06-14-2006 09:15 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