Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
abel5405 Absent Member.
Absent Member.
1948 views

Calling a Knowledge Script from Command Line

I am almost certain this is written down some where but unfortunately I can not find it. I know you can call discovery KS's from command line but how can you call a regular Knowledge Script from command line. We have a script we use to install agents and I would like to call the AMADMIN_ConfigAdminEvents and other config scripts after the install is done. I apologize if this is a duplicate question on the forums and many thanks in advance for your help.

v/r
Chris
Tags (1)
0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

Re: Calling a Knowledge Script from Command Line

abel5405 on %datetime% wrote:

>
>I am almost certain this is written down some where but unfortunately
>I can not find it. I know you can call discovery KS's from command
>line but how can you call a regular Knowledge Script from command
>line. We have a script we use to install agents and I would like to
>call the AMADMIN_ConfigAdminEvents and other config scripts after the
>install is done. I apologize if this is a duplicate question on the
>forums and many thanks in advance for your help.
>
>v/r
>Chris


Take a look at
https://www.netiq.com/documentation/appmanager-9/administratorguide/data
/cmdline_about_sample_scripts.html and see if these are what you are
looking for.

The scripts are found in NetIQ\AppManager\scripts.

--ebell
0 Likes
andy_doran Absent Member.
Absent Member.

Re: Calling a Knowledge Script from Command Line

ebell;2456563 wrote:
abel5405 on %datetime% wrote:

>
>I am almost certain this is written down some where but unfortunately
>I can not find it. I know you can call discovery KS's from command
>line but how can you call a regular Knowledge Script from command
>line. We have a script we use to install agents and I would like to
>call the AMADMIN_ConfigAdminEvents and other config scripts after the
>install is done. I apologize if this is a duplicate question on the
>forums and many thanks in advance for your help.
>
>v/r
>Chris


Take a look at
https://www.netiq.com/documentation/appmanager-9/administratorguide/data
/cmdline_about_sample_scripts.html and see if these are what you are
looking for.

The scripts are found in NetIQ\AppManager\scripts.

--ebell


"Running a KS from the command line" is really using a COM object called NetIQOLE. That COM object is NOT a part of the agent - it is delivered with the console(s) or on the MS. So a normal agent will not be avle to execute the VB Script example(s) mentioned above - or any other script that tries to use NetIQOLE.

You can distribute NetIQOLE to an agent if necessary, but you also have to be aware that this is basically a component that sits on top of ADO. Meaning you are going to be making direct calls into the QDB database from the agent when the script runs. Which may not actually be desirable. So if you are talking about an install that runs locally on the agent, after which you want to run a script to kick of jobs, you need to consider the implications of NetIQOLE and direct access to the QDB from the agent.

NetIQOLE is documented (see the chm file wherever the console is installed .. in the bin\help directory). NetIQOLE is 32 bit... so has to be invoked from a 32 bit shell...

There is a potential alternative... as noted, discovery jobs can be kicked off from the command line where the agent is installed. This is done via the nqdiscover.exe utility (which is shipped with all agents). This does not use NetiqOLE, but instead initiates communication with the MS service to cause the discovery job to run. So you can "cheat" (or be creative). If you run nqdiscover.exe without any switches you get some basic help. It will show that there is a -t switch... this specifies what you want to discover. So an example might be

c:\> nqdiscover -c AGENT -m MSSERVER -t NT

That would cause the Discovery_NT KS to be "dropped" on the agent AGENT via the MS MSSERVER. The key is the "-t"... -t NT means "Discovery_NT", -t SQLServer means "Discovery_SQLServer" and so on. So if you made a copy of AMADMIN_ConfigAdminEvents and called it Discovery_ConfigAdminEvents, then you could use this:-

c:\> nqdiscover -c AGENT -m MSSERVER -t ConfigAdminEvents

to run it... The drawback here is that the job runs with whatever parameter and settings are on the KS (NetIQOLE allows you to change values and schedules and so on when you create the job). So the KS copy would need whatever values set and they cannot be changed using the nqdiscover methof. Also of course, you would have a bunch of "Discovery" KSs that are not actually discovery (a Discovery KS has a property that specifies it as being discovery - it isn;t just down to the name, but these copies of KSs would appear in the Discovery tab).

So ... you would use NetIQOLE as the best way to create jobs and have control over them - providing you place NetIQOLE on the agents and are OK with them making direct SQL connections from the agent, or if the install is done remotely - then put NetIQOLE wherever that is. Or you could use nqdiscover.exe as a slightly less elegant mechanism if you copy the KSs you require as "Discovery_xyz" and can live with not being able to change values when creating the job.
0 Likes
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

Re: Calling a Knowledge Script from Command Line

Here is an example of a NetIQOLE script that Andy was referring to that can deploy any KS. Although NetIQOLE can reconfigure job parameters, schedules and advanced settings etc, this VBScript deploys the KS with all default settings so ensure the KS is configured as you wish it to be deployed. The script requires four command line arguments as follows:

  • SQL Instance
  • Repository Name
  • Name of KS to run including Category
  • Full path to a text file containing the agents on which to start the job

0 Likes
abel5405 Absent Member.
Absent Member.

Re: Calling a Knowledge Script from Command Line

Most awesome! Many many thanks to all for the info. All are great options and will make my life so much easier lol. Again many thanks.

v/r
Chris
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.