Why does this not work on NT4 SP6a?

Author Message
Invalid Character

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 3/7/2005
  • Location:
  • Status: offline
Why does this not work on NT4 SP6a? Monday, March 07, 2005 3:47 AM (permalink)
0
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
 
#1
    mbouchard

    • Total Posts : 2110
    • Scores: 29
    • Reward points : 0
    • Joined: 5/15/2003
    • Location: USA
    • Status: offline
    Re: Why does this not work on NT4 SP6a? Monday, March 07, 2005 3:51 AM (permalink)
    0
    What version of Windows Script Host do you have on the NT4 PC? If I am not mistaken exec requires version 5.6
     
    #2
      token

      • Total Posts : 1917
      • Scores: 0
      • Reward points : 0
      • Joined: 1/14/2005
      • Location:
      • Status: offline
      Re: Why does this not work on NT4 SP6a? Monday, March 07, 2005 7:11 AM (permalink)
      0
      You may want to try replace the following line:

      Set oExec = WshShell.Exec("C:\Program Files\Altiris\ALTIRIS AGENT\Software
      Delivery\{01B54EB5-3679-4C73-9E10-E169D5A5EC59}\cache\DirFind.bat")

      with:

      Set oExec = WshShell.Exec("cmd /c ""C:\Program Files\Altiris\ALTIRIS AGENT\Software Delivery\{01B54EB5-3679-4C73-9E10-E169D5A5EC59}\cache\DirFind.bat""")

       
      #3
        Invalid Character

        • Total Posts : 2
        • Scores: 0
        • Reward points : 0
        • Joined: 3/7/2005
        • Location:
        • Status: offline
        Re: Why does this not work on NT4 SP6a? Tuesday, March 08, 2005 3:29 AM (permalink)
        0
        I am using 5.6.8825 on my NT machine. Using the "cmd /c" bit does not work.

        The thing that seems most strange to me is that this exact script works on 9x, 2K, XP, and 2K3 machines, just not NT.
         
        #4
          token

          • Total Posts : 1917
          • Scores: 0
          • Reward points : 0
          • Joined: 1/14/2005
          • Location:
          • Status: offline
          Re: Why does this not work on NT4 SP6a? Tuesday, March 08, 2005 3:50 AM (permalink)
          0
          and the "" don't work either ?

          You might want to first determine whether the statements within the loop are actually executed and work from there.

           
          #5

            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • New Messages
            • No New Messages
            • Hot Topic w/ New Messages
            • Hot Topic w/o New Messages
            • Locked w/ New Messages
            • Locked w/o New Messages
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2012 ASPPlayground.NET Forum Version 3.9