|
Answer» First off let me make it clear I consider myself a amateur when it comes to batch scripting and I am learning as I go along and this site has been very helpful in GIVING me ides and solving some problems. Here is a script I recently wrote that gives basic computer info into a text file:
Quote echo off
:: Defining Variables for those of you who have come behind the creator for less confusion :: C_Date - CURRENT Date :: C_Time - Current Time :: Computer_Name - the host name :: Log_File - Name of the file that is ultimately created :: N_Location - Network Location of file :: Department - The department the computer is in that is being reported :: First_Name - User first name ie Han :: Last_Name - Users Last name ie Solo
echo. ECHO The purpose of this test is to gather data form a University Hospitals Computer ECHO. pause echo. set /p Last_Name=Your LAST NAME please? echo. set /p First_Name=and your FIRST NAME in full please (No Nicknames Thanks)? echo. set /p Department=The Department the computer is in ie Proctology or ER or NiCU or Psychology or Morgue? echo.
set Computer_Name=%COMPUTERNAME% REM echo. REM echo Your PC ID is %Computer_Name% REM echo. ::pause
:: for /f "tokens=1-5 delims=/ " %%d in ("%date%") do RENAME "hope.txt" %%e-%%f-%%g.txt for /f "tokens=1-5 delims=/ " %%d in ("%date%") do set C_Date=%%g%%e%%f REM echo. REM echo Current Date (YYYYMMDD): %C_Date% REM echo. ::pause
:: for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "hope.txt" %%d-%%e.txt for /f "tokens=1-5 delims=:" %%d in ("%time%") do set C_Time=%%d%%e%%f REM echo. REM echo Current Time (HHMMSS.XX): %C_Time% REM echo. ::pause set Log_File=%C_Date%.%Computer_Name%.%C_Time% REM echo. REM echo The name of the text file shall be %Log_File%.txt REM echo. REM pause set N_Location="%USERPROFILE%\Desktop\%Log_File%.txt" REM echo. REM echo %N_Location% REM echo. REM pause echo. echo Creating Text File on your desktop... ::space echo. > %N_Location% echo File Created on %C_Date% %C_Time% by %USERNAME% >> %N_Location% ::space echo. >> %N_Location% echo Individuals name submitting the report: %Last_Name%, %First_Name% >> %N_Location% ::space echo. >> %N_Location% echo Department they are reporting from: %Department% >> %N_Location% ::space echo. >> %N_Location% echo PC ID: %Computer_Name% >> %N_Location% ::space echo. >> %N_Location% echo System Type: %systype% >> %N_Location% ::space echo. >> %N_Location% psinfo >> %N_Location% ::space echo. >> %N_Location% IPConfig /all >> %N_Location% ::space echo. >> %N_Location% echo Current Running Processes at the time report was run... >> %N_Location% Tasklist >> %N_Location% cls echo. echo Thank You %First_Name% for submitting your report to the IT^&S Service Desk. echo We have your system information and have noted you are in the %Department% department. echo. echo. echo. echo. echo. echo This message will self-destruct in five seconds. echo. ping 127.0.0.1 -n 20 -w 1000 > nul echo.
Simply enough I think...
The question is how do I take the finally output where ever it lands in a txt file format and have it show up in a Microsoft Exchange 2003 Public Folder?
Make sense? Understand? Questions... comments please any advice would be very helpful.
Thanks
An amended thought... does someone know how I might send this to a email address through batch scripting or does anyone know of another script/program I can call to email a notification to?
Still doing the research myself but thought I would throw all of this out here and see what sticks!
Thanks again...I have been shown some light on this...
Quotemailto:to?subject=subject&cc=cc_address&bcc=bcc_address&body=message_body
to_address The (escaped) e-mail address of the recipient; allowed formats: • [email protected] • Full%20Name<[email protected]> subject The (escaped) subject field of the message cc_address The (escaped) "carbon copy" e-mail address; allowed formats: • [email protected] • Full%20Name<[email protected]> bcc_address The (escaped) "blind carbon copy" e-mail address; allowed formats: • [email protected] • Full%20Name<[email protected]> message_body The actual message body (escaped too)
But the syntax ELUDES me a little and I am still getting error messages.
Anyone familiar with this or have a better website to view for help then this one http://www.robvanderwoude.com/email.php
ThanksOkay after further research I have found that even if I get the syntax to work that this is not what I needed. I think I need a third party simple executable that I can reference and use in a COMMAND line.
Anyone got any ideas?
ThanksMailto is used to pre-fill a mail form. The user is still required to click the send button.
You can try this 3rd party free program: blat. It comes as a zip file with the documentation included.
Alternatives include any Windows script language that is COM aware. (VBScript, Python, etc). If you have access to Powershell, there is a Send-MailMessage cmdlet for this purpose.
Good luck.
|