The script creates the INI file, but does not populate it, even though the directory contains files and has a modified date. This script works on all other platforms.
_________________________________________________________
Option Explicit
Dim fso
Dim wshShell
Dim oExec
Dim sCmd
Dim sCurrentLine
Dim sStartFldr
Dim sCurrentFldr
Dim sPath
Dim sIniFile
Dim oIniFile
Dim arDateString
'* Create objects to access the file system and Windows shell
Set fso = CreateObject("Scripting.FileSystemObject")
Set wshShell = CreateObject("WScript.Shell")
'* Create an INI file called NetscapeMail.ini which the custom inventory
'* collector will be able to query.
'* I am currently creating this under C:\Program Files\Netscape but this is
'* arbitrary and may need to be moved due to security restrictions etc.
'* SK - The INI file is now created within the IS Agent cache directory. - SK
'* It is also worth noting that C:\Program Files may be called something
'* different in non-English languages so some tests may need to be carried out
'* to determine the precise location.
'* Note: the file will overwrite any previous version.
sIniFile = "C:\Program Files\Altiris\ALTIRIS AGENT\Software Delivery\{01B54EB5-3679-4C73-9E10-E169D5A5EC59}\cache\NetscapeMail.ini"
Set oIniFile = fso.CreateTextFile(sIniFile, True)
'* The script uses an associated batch file called DirFind.bat that must be
'* in the same folder as this script.
'* The batch file runs the following command:
'*
'* Dir "C:\Program Files\Netscape\Users" /AD | Find "Mail"
'*
'* The following command uses the Exec method of the WshShell object
'* to pipe the results of the above command to standard output
'* where it can be parsed to retrieve the appropriate information.
'* SK - The DirFind.bat file is placed into the Inventory Solution directory on the NS. - SK
Set oExec = WshShell.Exec("C:\Program Files\Altiris\ALTIRIS AGENT\Software Delivery\{01B54EB5-3679-4C73-9E10-E169D5A5EC59}\cache\DirFind.bat")
'* Once the above command has been run, standard output should consist
'* of a number of lines, each containing just the folder name returned.
'* Each folder name can then be queried for the size and last modified date.
Do While Not oExec.StdOut.AtEndOfStream
'* Set an object reference to the current folder name so that we can
'* extract the folder attributes
sPath = "C:\Program Files\Netscape\Users\" & oExec.StdOut.ReadLine
Set sCurrentFldr = fso.GetFolder(sPath)
oIniFile.WriteLine "[Mail]"
oIniFile.WriteLIne "Size=" & sCurrentFldr.Size
oIniFile.WriteBlankLines 1
oIniFile.WriteLine "[DateLastModified]"
'* Split DateLastModified into Date and Time components
arDateString = Split(sCurrentFldr.DateLastModified)
oIniFile.WriteLine "Date=" & arDateString(0)
oIniFile.WriteLine "Time=" & arDateString(1)
oIniFile.WriteBlankLines 1
'* Destroy the object reference
Set sCurrentFldr = Nothing
Loop
'* Close the INI file when complete
oIniFile.Close
'* Ensure that all created objects are destroyed after use
Set oIniFile = Nothing
Set oExec = Nothing
Set wshShell = Nothing
Set fso = Nothing