Can i add this script to BigFix

when execute manually it works great - how can i add to a fixlet? do i need to add any additional commands

REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search /v SearchboxTaskbarMode /t REG_DWORD /d 0 /f

You can add to your Fixlet, but remember the BES Client is running as a LOCAL system and NOT the current logged in user. In your example of the REGISTRY update, your focusing on HKEY_CURERNT_USER - So you need to use the override feature as @TimRice explained on a different post… ( Unable to Run "RunAsCurrentUser.exe Script for MSI )

You would be looking for something like …

Override wait
RunAs=CurrentUser
Hidden=True
Wait

======================================
Also since you are targeting the USER HIVE, you may want to take action when someone is logged in

Lastly, to make your Fixlet truly elegant, your RELEVANCE should test the HIVE KEY and ONLY be applicable if it does not match the setting you want it to. Otherwise what you really have is a TASK, and no way of knowing if the value is already set correctly.

thanks dpowers1 i added the additional commands but it returns with error

override is not recodnized as an internal or external command

@echo off
Override wait
RunAs=CurrentUser
Hidden=True
REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search /v SearchboxTaskbarMode /t REG_DWORD /d 0 /f
pause

Ahh… your snippet your calling from a DOS window? It is a bit confusing :wink:
You can run DOS/BATCH files from BigFix… but for something as trival as this you can use BigFix ACTION language here to update your registry. Example below (taken from bigfix.me as I am not in front of a machine I can give you better example:

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “”=“registry"
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “Title”=”{parameter “Title”}“
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “Category”=”{parameter “Category”}“
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “Desc”=”{parameter “Desc”}“
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “Key”=”{parameter “Key”}“
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “Value”=”{parameter “Value”}“
if {parameter “Interval” != “900000”}
regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Admin\Settings\Service {parameter “Title”}]” “Interval”=”{parameter “Interval”}"
endif

==================================
Above is from a Fixlet example using Bigfix Action language (not calling a script) to manipulate the registry.

I suggest you refer to the ACTION PDF guide for BigFix, that should help you with this and how to use OVERRIDE as well. If you continue to struggle, ping me back and I’ll do it my lab and send you screen shots (when I am not on a plane).

Otherwise you can create a BATCH file on the fly and execute it… using the OVERRIDE to target the current user.
Example:

// Remove any prior attempts
delete __appendfile
delete mybatch.bat

// Create the batch file
appendfile @ECHO OFF
appendfile @dir “{pathname of system folder}” > c:\test.txt <-- replace with your actions!!

// batch file was created as __appendfile
// move it to a batch file name
move __appendfile mybatch.bat

// now run it (using override to run batch file as Curernt User
Override wait
RunAs=CurrentUser
Hidden=True
wait mybatch.bat

You can also form the registry path into the HKU hive instead using the user key of the current user (HKCU is just a mapping into HKU)

See https://developer.bigfix.com/relevance/reference/logged-on-user.html#user-key-of-logged-on-user-registry-key

This means instead of

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search

You could do something like:

{name of user key of current user}\Software\Microsoft\Windows\CurrentVersion\Search
2 Likes

i know i’m doing something wrong

// Remove any prior attempts
delete __appendfile
delete CortanaSearchboxDword.bat

// Create the batch file
appendfile @ECHO OFF
appendfile @dir “{\myserver\NETLOGON\CortanaSearchBox}” > \myserver\NETLOGON\CortanaSearchBox.bat

// batch file was created as __appendfile
// move it to a batch file name
move __appendfile CortanaSearchboxDword.bat

// now run it (using override to run batch file as Curernt User
Override wait
RunAs=CurrentUser
Hidden=True
wait CortanaSearchboxDword.bat

You probably should execute this in a cmd.exe like

wait cmd.exe /C CortanaSearchboxDword.bat

This script also is assuming that \myserver\NETLOGON\CortanaSearchBox exists on the endpoint

thanks AlanM

\myserver\NETLOGON\CortanaSearchBox is actually my Domain controller where the file is located.

should i remove \myserver\NETLOGON\CortanaSearchBox where its bolded below?

// Remove any prior attempts
delete __appendfile
delete CortanaSearchboxDword.bat

// Create the batch file
appendfile @ECHO OFF
appendfile @dir “{\myserver\NETLOGON\CortanaSearchBox}” > *myserver\NETLOGON\CortanaSearchBox.bat*

// batch file was created as __appendfile
// move it to a batch file name
move __appendfile CortanaSearchboxDword.bat

// now run it (using override to run batch file as Curernt User
Override wait
RunAs=CurrentUser
Hidden=True
wait cmd.exe /C CortanaSearchboxDword.bat

You need to escape some things or \\myserver comes across as \myserver

What this means is that the user you are running as needs to have access to read (and write if you are redirecting) to that network share. I can’t tell what you are trying to do here as its all external to the script.

If you want this to affect all users, even those that haven’t logged in yet, and in cases where there is no user logged in at all, then you need to use Local GPO to do this, not regedit.

You can deploy Local GPO with BigFix and it works well.

See these examples:

See this related post for some more up to date info: