2 Replies Latest reply on Mar 4, 2009 6:47 PM by rsterling

    VBScript or batch to copy txt file back to core

    Apprentice

      Hi folks, I have an inventory VBScript that collects the data I want and just collects it all to a local *.txt file.  At the end of my script I want to copy this file back to the core.  I don't want to store this data in the local registry and then read it later, nor do I even want this data to be in my LDMS database.  I have a LANDesk script to copy files from the client PC to a location on the core, but I would rather somehow invoke this process with one action.  So near the end of my vbs data collection script, I just want it to copy my "C:\MigData.txt" to the core and, of course name it something like .txt.  The script is not a problem, the question is more of how do you recommend I copy the text file back?  I'd rather not provide credentials in my VBS or BATCH and do a net use or anything like that (if I dont have to).

       

      Usually, I write my data to the registry and then edit ldappl3.ini accordingly and at the end of all my VBS's I run something like this to invoke the inventory.  I was wondering if there isn't something similar that would copy a file back to the core?

       

      btw, in this case I am firing off my VBS with a BAT file so I can use the current user account to gather my data.  So I guess I could script this in either place, vbs or batch.

       

      sProgram = """C:\Program Files\LANDesk\LDClient\LDISCN32.EXE""" & " /NTT=:5007 /S= /I=HTTP://core/ldlogon/ldappl3.ldz /F /NOCD /SYNC"

      objShell.run (sProgram)

       

      How would I fire off something like this: (Thinking ang typing out loud)

      REMCOPY0=%FOLDER_ON_CORE%\%Computer - Device Name%-%CUSTJOBHOSTIP%.txt, %LOCAL_PC_C%\MigData.txt, FROMREMOTE

        • 1. Re: VBScript or batch to copy txt file back to core
          Employee

          that stuff needs to run from a managed script, the variables are resolved on the core using its database knowledge. I've started the process of writing a tool that creates //server/share/machine/user directories as part of a file upload program, but probably doesn't do much for you (it's in Perl of course, and it'll be a while before I finish at this rate). Still, the general idea is straightforward enough for a language powerful enough to iterate...

          1 of 1 people found this helpful
          • 2. Re: VBScript or batch to copy txt file back to core
            Apprentice

            I think I *may* have something here...

             

            Run from source!  (Preferred server) Then instruct your VBS to copy to current wscript source.

             

            Tested once.

             

            sn = Wscript.ScriptName '        Script Name       
            fn = Wscript.ScriptFullName '    Fully Qualified Script Name
            fp = Replace(fn, "\" & sn, "") ' Drive / Folder path

            set demofile = objFSO.GetFile("c:\MigData.txt")
            demofile.Copy(fp & "\" & strCompName & "-" & strUser & ".txt")