Hi
Im new at this vbs scripting...but trying slowly to learn and using the script56.chm.
But this script is acting wierd? im trying to collect the windows caption and version export it to a CSV file.
If the file isnt created then create it. If it is created then append to it.
When i run it first time it goes okay? but when i run it again - then i get some chinese text???
from the csv file from the second run of the script
"Microsoft Windows 7 Professional ","6.1.7601"
The script look like this. What have i done wrong?
Const ForWriting = 2, ForAppending = 8 strFile = "V:\UDvikling\objOperatingSystem.csv" Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(strFile) Then Set objLogFile = objFSO.OpenTextFile(strFile, _ ForAppending, True) Else Wscript.Echo "File does not exist." Set objLogFile = objFSO.CreateTextFile(strFile, _ ForAppending, True) End If Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems objLogFile.Write chr(34) & objOperatingSystem.Caption & chr(34) & "," objLogFile.Write chr(34) & objOperatingSystem.Version & chr(34) objLogFile.Writeline Next objLogFile.Close