Action script

(imported topic written by jmlafreniere91)

Hello, I’m trying to move create some Fixlet messages using action scripts and I’m not sure if I’m doing the proper thing. The script will work, but the test computer will never report having “completed” the installation (status: wait).

Here’s an example of my script:

Script type = BigFix Action Script

Action Script:

// enter your action script here

wait “\domainname\netlogon\patches\Cisco\vpnclient.cmd”

End, exit and quit doesn’t seem to work if I try to put it after the command line.

Could you please tell me what would be the correct command to make sure the script is completed and reports it as completed ?

Regards,

Jim

(imported comment written by BenKus)

Hi Jim,

The agent runs as the SYSTEM account so it won’t have access to shares by default… It is probably best to download the package to the agent (use the software distribution wizard).

See a similar post yesterday:

http://forum.bigfix.com/viewtopic.php?id=4174

Ben

(imported comment written by jmlafreniere91)

Thanks Ben. Could you please tell me where I can find more information on the scripting syntax ?

Best regards,

Jim

(imported comment written by jmlafreniere91)

As an example, I have some batchfiles (.cmd) that I won’t to run, and the run command (run “…\test.cmd”) always reports “failed”.

I know I have to use “script” to run a .vbs, but what syntax should I use with a .cmd ? And a .msi ?

(imported comment written by BenKus)

Hey Jim,

Check out the action guide and examples at: http://support.bigfix.com/fixlet/

The “Failed” status means something special when running Fixlets (because fixed/failed status is determined by the relevance of the Fixlet)… See: http://support.bigfix.com/cgi-bin/kbdirect.pl?id=68 (if you are running Tasks or custom actions, completed/failed status is determined if all lines executed).

Here are some examples to run some scripts:

waithidden cmd.exe /C C:\test.bat

waithidden cscript.exe C:\test.vbs

waithidden msiexec.exe C:\test.msi /quiet

Note: actions run with a current working directory of the directory of the Fixlet site (not the folder the file was downloaded in)… So if your batch script is expecting files from the extracted package, then add “cd __Download” to the front of your batch script before you run it…)

Ben

(imported comment written by jmlafreniere91)

Ben, sorry to bother you again, but cd __Download doesn’t seem to work when I put it in front of my script. Could you please give me a full example ?

My .msi file is on a URL, how do I “download” it to the Bigfix then script the installation ?

Here’s what I’ve tested so far:

cd __Download C:\test.msi /quiet

waithidden msiexec.exe C:\test.msi /quiet

OR

cd __Download waithidden msiexec.exe C:\test.msi /quiet

I get "Unable to parse Action1 line 3, unknown action command.

Thanks again.

Jim

(imported comment written by BenKus)

Hey Jim,

My comment about “cd __Download” was meant for inside the actual batch script itself… You can try it without that part and see if it works…

Ben

(imported comment written by jmlafreniere91)

I’m sorry, but I don’t understand. How is my batch file (.cmd) would understand that command ? Or is it Bigfix that will actually read it ?

Thanks,

Jim

(imported comment written by jmlafreniere91)

Ok, here’s an example.

Bigfix Action script:

// enter your action script here

download “\cogeco.com\netlogon\ITSD\patches\ICUM\InterCallUnifiedMeeting.msi”

runhidden msiexec /i InterCallUnifiedMeeting.msi /quiet

I keep getting this error when applying:

Downloads

File

\cogeco.com\netlogon\ITSD\patches\ICUM\InterCallUnifiedMeeting.msi

Status

Failed

Details

Server error: “Non-retryable Error: Http_err_BAD_URL”

send retry request to server

If you want, I can send the export over to you if you provide your email address.

Jim

(imported comment written by BenKus)

Hi Jim,

You can’t run or download the file from the share… Try this:

  • Go to the Software Distribution Wizard in the Console (under the “Wizards” menu).
  • Follow the wizard and browse to the file and go through the different pages of the wizard.
  • When it is done, deploy the action to your computers.

By following this method, you won’t need to bother making the Fixlets by hand…

Let me know if that works for you,

Ben

(imported comment written by jmlafreniere91)

Ok, thanks Ben, it seems to be working !

Now, LAST question: could you please give me the correct script for the following:

  1. Add the following REG KEY:

HKEY_LOCAL_MACHINE\Software\Envision\Click2Coach\AgentSupport

“WriteToLogFile”=“TRUE”

  1. Execute the following CMD:

if exist “%appdata%\Microsoft\Signatures\Cogeco.sig” echo Signature files already installed > “%appdata%\Microsoft\Signatures\Cogeco.log”

if not exist “%appdata%\Microsoft\Signatures\Cogeco.sig” copy /y “\cogeco.com\netlogon\itsd\templates\signature\Cogeco.*” “%appdata%\Microsoft\Signatures”

  1. Execute the following VBS:

\cogeco\netlogon\CMAgent.vbs

I know I cannot run a script using a URL, but how do I download it to the Bigfix server ?

Also, can I merge a REG KEY and a CMD file in the same script ?

I’m trying the following and I’m getting a “failed” result:

regset "

HKEY_CLASSES_ROOT\CLSID{020f6116-407b-11d3-a3bb-00c04fa32518}\InprocServer32

" “ThreadingModel”=“Apartment”

Could you please explain why it doesn’t work ?

Best regards,

Jim

(imported comment written by BenKus)

Hey Jim,

You are on the right track… Since the opening curly brace “{” is a special character in actionscript, it needs to be escaped (here is another example: http://forum.bigfix.com/viewtopic.php?id=4125)

regset “HKEY_CLASSES_ROOT\CLSID{{020f6116-407b-11d3-a3bb-00c04fa32518}\InprocServer32” “ThreadingModel”=“Apartment”

You can’t run cmd file or vbs on a share because the agent runs as SYSTEM and doesn’t have access to the network files. You will need to put them in a folder and use the software distribution wizard to deploy the folder… Then you can add the regset to the top of the action.

Ben

(imported comment written by jmlafreniere91)

It works, thanks ! Ok, I know I said last question previously… :slight_smile:

  1. Is there any advanced guide to scripting, because the 4 pager that I have is kinda… basic !

  2. Also, we are using a VBS to deploy our antivirus and it doesn’t seem to work when deployed using Bigfix. The reason we are using this script is because it checks for the OS language version and that option doesn’t seem to exist in Bigfix.

I know the regkey that needs to be checked, but could you please provide me with is the EXACT code I should use if I want to look for a value under a regkey ?

My example:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nls\Language

“InstallLanguage”=“040C”

So, if value of registry is “040C”, then it will install one specific MSI, and so on.

Thanks,

Jim

(imported comment written by jessewk)

Hi Jim,

  1. Yes, there is lots of advanced documentation at http://support.bigfix.com/fixlet . Also we have a number of training options you might be interested in: http://support.bigfix.com/training/curriculum.html

  2. You can definitely use BigFix to check for specific languages. We use relevance like this in our patch content:

(language of version block of file “kernel32.dll” of system folder contains “Japanese”) AND ((not exists key “HKLM\System\CurrentControlSet\Control\Nls\MUILanguages” of registry) OR (not exists value of key “HKLM\System\CurrentControlSet\Control\Nls\MUILanguages” of registry))

If you want to check the value you posted, you can use this:

exists value “InstallLanguage” whose (it as string = “040C”) of keys “HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nls\Language” of registry

At a minimum, I would suggest using the ‘CurrentControlSet’ key rather than ControlSet001

Jesse

(imported comment written by jmlafreniere91)

Thanks Jesse, I found it finally and that seems to be working (the relevance), although the installation doesn’t seem to be working. I’ve created another post for that issue, maybe you can have a look at it.

(imported comment written by jmlafreniere91)

Ben, I have enabled the following action script:

regset "

HKEY_CLASSES_ROOT\CLSID{{020f6116-407b-11d3-a3bb-00c04fa32518}\InprocServer32

" “ThreadingModel”=“Apartment”

And although it actually writes the key to the registry, the result is still “Failed”. Relevance is “All computers”.

What am I missing ? Is there an “end” to put at the end of the script ? I’ve also tried to enable the “Custom success criteria” and tried the three possibilities to set the “Consider this action successful when…” and it still gives me a “Failed” result, unless I chose “all lines of the action script have completed successfully”, which is not a good option for me, as I need to know if the key was actually applied.

Regards,

Jim

(imported comment written by jessewk)

If it’s a Fixlet you will want to use relevance that checks the value of the key. You relevance should be something like this:

exists key “HKEY_CLASSES_ROOT\CLSID{020f6116-407b-11d3-a3bb-00c04fa32518}\InprocServer32” whose (not exists value “ThreadingModel” whose (it as string = “Apartment”) of it) of registry

A Fixlet with the above relevance would be applicable if the key exists but the value doesn’t exist or has an incorrect value. It will be considered successful if the relevance evaluates to false after the action has completed.

Jesse