Change Registry Setting via K1000 Script
I am trying to make a registry change via a K1000 Script. Most recently I tried creating the script using the Registry Settings Configurator (Configuration Policy: Enforce Registry Settings). The type for the value I am trying to update is REG_BINARY, but gets created as REG_SZ by the KACE script. When click on "To edit the policy using this editor", I cans see that the type is correctly set to REG_BINARY. Any idea why this is happening or how to fix the issue? I saw some mention of a somewhat similar issue but with a different version ofr the KACE agent (I have 5.3.47927).
I also tried to make the change using a "Reg Import" in a batch file. This script works fine when run locally on a system but when pushed out with KACE via an Online Shell Script, it appears to run succesfully (no errors in Activity Log) but the registry does not get changed at all. My VBscript skills are week and Powershell....nonexistent, but I can cobble together something if that's will get the job done.
Thanks in advance for any assistance.
-
Has this issue returned in 5.5? I'm running into the same problem where the batch file runs on the PC locally, but runs with no errors via Kace push, but no changes have been made. - jharrell 10 years ago
Answers (5)
I found using reg.exe /add in batch scripts works for just a registry poke. when switched machines between domains I used this to change a few keys.
start /wait reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v SearchList /d "" /f
start /wait reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v NameServer /d "10.16.19.7" /f
start /wait reg.exe add "HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters" /v UseDomainNameDevolution /t REG_DWORD /d 1 /f
start /wait reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v LSFORCEHOST /d "MS-VDF.TMCCACAD.TMCC.EDU" /f
start /wait reg.exe add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v MINITAB_LICENSE_FILE /d "@\\dr-vdf.TMCCACAD.TMCC.EDU" /f
start /wait reg.exe add "HKLM\SOFTWARE\Minitab\Minitab16\Install Options" /v MINITAB_LICENSE_FILE /d "@\\\\dr-vdf.TMCCACAD.TMCC.EDU" /f
There was a registry bug that caused that issue in one of the early versions of 5.3, so I'd suggest upgrading your K1000 to 5.3.53053. Make sure you update your agents to 5.3.53177 as well.
http://www.kace.com/support/resources/kb/article/Steps-to-download-and-upgrade-Dell-Kace-K1000-Appliance-Software-to-version-5-3
Here's my setup for a couple of scripts I use for changing/enforcing registry settings. Running 5.3.53053 and working fine. Hope these help!
John
_____________________________
Script Type:
Online KScript
Name:
Disable Offline Files (XP)
Description:
Enforces registry setting to disable Offline Files (Windows XP).
Limit Deployment To Selected Labels:
winxp
Pick Specific OS Versions:
Microsoft Windows XP Professional SP3
Microsoft Windows XP Professionnel SP3
Run As:
Run As User logged in to console
Scheduling:
Run every 12 hours
Task 1
Verify
Verify that “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache” exists.
Verify that “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache!Enabled” is equal to “0x00000000”.
On Success
Log “Offline Files already disabled.” to “status”
Remediation
Set “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache”.
Set “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache” to “0x00000000”.
On Remediation Success
Log “Offline Files successfully disabled, changes will take effect on reboot.” to “status”.
On Remediation Failure
Log “Failed to disable Offline Files.” to “status".
________________________________________________________
Corresponding reg command & registry entry:
reg add hklm\software\microsoft\windows\currentversion\netcache /v enabled /t reg_dword /d 0 /f
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache]
"Enabled"=dword:00000000
________________________________________________________
________________________________________________________
Script Type:
Online KScript
Name:
Redirect My Documents
Description:
Enforces registry setting to redirect targeted users' My Documents folders to their respective user folders (I:).
Limit Deployment To Selected Labels:
redirectmydocs
Pick Specific OS Versions:
Microsoft Windows XP Professional SP3
Microsoft Windows XP Professionnel SP3
Run As:
Run As User logged in to console
Scheduling:
Run every 12 hours
Task 1
Verify
Verify that “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders” exists.
Verify that “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders!Personal” is equal to “i:\My Documents”.
Verify that “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders!My Pictures” is equal to “i:\My Documents\My Pictures”.
Verify that “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders!My Music” is equal to “i:\My Documents\My Music”.
On Success
Log “My Documents folder already redirected.” to “status”
Remediation
Set “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders”.
Set “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders!Personal” to “i:\My Documents”.
Set “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders!My Pictures” to “i:\My Documents\My Pictures”.
Set “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders!My Music” to “i:\My Documents\My Music”.
On Remediation Success
Log “My Documents folder successfully redirected, changes will take effect on reboot.” to “status”.
On Remediation Failure
Log “Failed to redirect My Documents folder.” to “status".
Comments:
-
Verify that “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache!Enabled†is equal to “0x00000000â€.
John, when I was trying to enter this, there was no "IS EQUAL TO" just "LESS THAN OR EQUAL TO" or "GREATER THAN OR EQUAL TO". - gcarpenter 12 years ago -
I used the Registry Settings Configurator (Scripting > Configuration Policy > Enforce Registry Settings) to get that setting - useful for setting up the script initially (and tweaking the "wizard" results further).
John - jverbosk 12 years ago
This is a known bug of release ( 5.3.47927 ) we was also facing this problem that we need to update REG_BINARY, but KACE changes it to REG_SZ, so we opended a ticket with kace and they suggest us that we need to upgrade our KBOX to 5.3.53053.
We are in process of upgrading our servers , will share the results once our upgrade is finished and tested.
Comments:
-
That's what I suspected. Thanks for the confirmation. - etipton 12 years ago