7 Replies Latest reply: Mar 10, 2011 2:16 AM by Jonathan Coop RSS

use vbs as part of a psl collector ?

Johan Landerholm

Hi all,

 

I would like to use a very small vbs script inside a normal psl collector. I would like to output some text from my vbs script and process the output in psl.

 

Is this possible ?

Has anyone a working example ?

 

I wouldn't like to copy a script file to the destination machine. The script is only a few lines, so I would like to have it inside the psl code if possible ?

 

Best regards,

Johan

  • 1. use vbs as part of a psl collector ?
    Jonathan Coop

    VBScript is supported, is supported you can use the PSL execute function, but note the recent posting about a library not being properly registered on the latest version of Patrol Agent.

     

    What are you looking to do with your VBScript?.

     

    Jon

  • 2. use vbs as part of a psl collector ?
    Johan Landerholm

    My goal is to write a small script to get basic information about the machine running the agent.

    This is a very simple discovery procedure, we only have about 300 agents so it is a very small site.

     

    I already can find the platform and OS from the PatrolAgent itself, but I would also like to find out serial number of the machine, model number, OS version number, patches, and a few other things accessable via WMI.

     

    I have a vb script to pull this information from the machine, but it needs to be run locally on the machine.

    My idea then is to connect a developer console (classic), load the KM and let it run the vb script and populate parameters with the results. That's why I would like to run it "inside" PSL code.

     

    I saw some other post about the execute() psl statement does not send back StdOut text to the psl code, like I'm used to on the solaris platform.

    Is my only option to write a file in the filesystem, and then have a psl collecto to parse the file ?

    Or is there an easier way of doing it ?

     

    /Johan

  • 3. use vbs as part of a psl collector ?
    Jonathan Coop

    Hi Johan

     

    I tried and your right the stdout doesn't go to standard out like it should (IMHO).

     

    However the following does seem to work.

     

    PSL task:

     

    print("Output I got:".system("cscript c:\\vbs\\hello.vbs")."\n");

     

    Hello.vbs code:

     

     

    WScript.StdOut.Write("Hello World!")

     

    #what else could it possibly output as an example of code! 

     

    You should then be able to manipulate as you see fit in PSL

     

    The output I got for my simple PSL task:

     

    Output I got:Microsoft (R) Windows Script Host Version 5.7

    Copyright (C) Microsoft Corporation. All rights reserved.

     

    Hello World!

     

     

    Hope this helps

     

     

    Jon

  • 4. use vbs as part of a psl collector ?
    Johan Landerholm

    Looks very promising!

     

    I have now tried to use "PSL Here" code in my collector, because the vbs code became too many lines.

     

    I have also tried to write a text file from vb to c:\temp to be able to parse the file using the cat command later.

    But I will also try your suggestion.

     

    Thanks!

     

    /Johan

  • 5. use vbs as part of a psl collector ?
    Johan Landerholm

    Looks like I asked the same question as in

    https://communities.bmc.com/communities/thread/49162

     

    I re-registered the psh.dll with "regsrv32 psh.dll" and my vbscript was working perfectly again.

     

    Thanks for your help!

     

    /Johan

  • 6. use vbs as part of a psl collector ?
    Johan Landerholm

    Hmm, it looks like it's not working on Windows 2008 either.

    The solution to reregister the dll isn't scaling to hundreds of servers.

    I need to find another solution. Or wait another year to have all my agents reinstalled with a new (fixed) patrol version.

  • 7. use vbs as part of a psl collector ?
    Jonathan Coop

    Hi Johan

     

    One thought of course is that my suggestion using system function, and cscript avoids all the problems associated with psh.dll as this simply isn't used. Everything is OS based, as far as Patrol is concerned.

     

     

    Might be worth a try, and is probably more efficient than writing to file.

     

     

    Regards

     

     

    Jon