Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script logging

Status
Not open for further replies.

SAToronto

IS-IT--Management
Sep 21, 2011
199
CA
Can anyone tell me why my script outputs this to the log?

ㄱ㠯㈯㄰‱ㄱㄺ㨵㤰䄠्湉潦䌉䵏啐䕔乒䵁⁅›਍ㄱ㠯㈯㄰‱ㄱㄺ㨹ㄱ䄠्湉潦䌉䵏啐䕔乒䵁⁅›਍
here is the script

on error resume next
Dim fso, oLogFile
CONST ForAppending = 8
CONST LOG_FILE_NAME = "adobeUninstall.log"
CONST LOG_Path = "\\torsrvdc1\gpo\"

Set fso = CreateObject("Scripting.FileSystemObject")
Set oLogFile = FSO.OpenTextFile(LOG_PATH & LOG_FILE_NAME, ForAppending, True)
oLogFile.WriteLine Date & " " & Time & vbTab & "Info" & vbTab & "COMPUTERNAME : " & sComputerName


Set WshShell = CreateObject("WScript.Shell")
' Uninstall Acrobat
WshShell.Run "msiexec /x {AC76BA86-1033-F400-7760-000000000005} /q",1,true

oLogFile.Close

All I am trying to do is log that the script ran ok and the details.....comp name..date and time
 
Character Set? Force the ASCII CharSet by passing a 0 to the the .OpenTextFile method()

Code:
set oLogFile = FSO.OpenTextFile(LOG_PATH & LOG_FILE_NAME, ForAppending, True[red], 0[/red])

Also, move the oLogFile.Close to before the Acrobat unistall. With so many update coming from Adobe, I wouldn't be surprise if the uninstall is somehow toying with your log file.

-Geates



"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Hi Geates
I tried what you suggested and it still output the same...weird stuff. To remedy, I moved the log location from an 08r2 server to an 03r2 server and the output was normal. However the output doesnt seem complete as there is not computernames in the log
here is what I have adjusted the code to

on error resume next
Dim fso, oLogFile, sComputername
CONST ForAppending = 8
CONST LOG_FILE_NAME = "adobeUninstall.log"
CONST LOG_Path = "\\toronto09\GPlogs$\"
sComputerName = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

Set fso = CreateObject("Scripting.FileSystemObject")
Set oLogFile = FSO.OpenTextFile(LOG_PATH & LOG_FILE_NAME, ForAppending, True, 0)
oLogFile.WriteLine Date & " " & Time & vbTab & "Info" & vbTab & "COMPUTERNAME : " & sComputerName
oLogFile.Close

Set WshShell = CreateObject("WScript.Shell")
' Uninstall Acrobat
WshShell.Run "msiexec /x {AC76BA86-1033-F400-7760-000000000005} /q",1,true

here is the output to the log

11/9/2011 7:12:20 AM Info COMPUTERNAME :

 
your original post didn't define sComputerName. Try using the Netowrk WMI object instead of the Enviromental variable.

Code:
set objNetwork = CreateObject("Wscript.Network")
sComputerName = objNetwork.ComputerName

Also, to force ASCII use -2 not 0. 0 represents the systems default codset.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top