Kaseya Community

Setting a value for a not-yet-existing Registry key in Win7 ( 64-bit)

This question is not answered

Hello,

I've been building agent procedures in Kaseya for a little under a year now - but it's all been writing Files & executing MSI or EXE files.  I'm taking a step to make our IT Dept. more efficient and I need to learn how to start automating some of our more common processes.  What I'm trying to understand right now is using Kaseya to modify the registry.  Some info on my current situation:

  • Our network recently purged all WinXP Machines - all of our End-User devices are now Windows 7 (64-bit).  Our servers are mostly Windows Server 2008 R2
  • Our end users are always set as Win7 "Users" via GPO - Only Team IT users are auto-Admins
  • Certain users require specific websites to be added to their machines' "Trusted Sites" list after installing Citrix - a process I'm looking to wrap up in 1 procedure instead of just pushing the install
  • I'm pretty familiar with the Agent Procedure building proccess - but as I said, I've mostly dealt with installing programs.
  • We are using Kaseya version 6.2.0.0, agent version 6.2.0.16 - 1.2.0.22

I found some info on how to set the Trusted Sites via the Registry from here - http://nefaria.com/2009/10/adding-trusted-sites-for-ie-via-the-registry/ - So I've ben using that info to guide where I'm setting things now.  I started looking into editing the registry through Kaseya today, and this seemed somewhat helpful - http://community.kaseya.com/kb/w/wiki/509.aspx - but I'm still confused as to how to achieve my end-goal here.  Searching around the forums didn't turn up anything that looked useful to me either.  I've tried using the method of "Set Registry Value" As sen in my Procedure export, here:

------------------------------------------
<Procedure folderId="77624817617346249177252214" id="363736543" treePres="3" name="Test to add a new Reg Key & Value">
<Body description="">
<If description="">
<Condition name="True"/>
<Then>
<Statement name="SetRegistryValue" description="Set the specified registry value - Regedit displays keys as folders and values as documents." osType="Windows" continueOnFail="false">
<Parameter name="RegistryPath" value="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\afnet.achievementfirst.org\http" xsi:type="StringParameter"/>
<Parameter name="Value" value="2" xsi:type="StringParameter"/>
<Parameter name="DataType" value="Integer" xsi:type="EnumParameter"/>
</Statement>
<Statement name="SetRegistryValue" description="Set the specified registry value - Regedit displays keys as folders and values as documents." osType="Windows" continueOnFail="false">
<Parameter name="RegistryPath" value="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\afnet.achievementfirst.org\https" xsi:type="StringParameter"/>
<Parameter name="Value" value="2" xsi:type="StringParameter"/>
<Parameter name="DataType" value="Integer" xsi:type="EnumParameter"/>
</Statement>
</Then>
</If>
</Body>
</Procedure>
------------------------------------------

The problem with that was that whenever I ran it, nothing happened - nothing changed - even tho the procedure says that it completed - "Script Summary: Success THEN" .  I would reboot the computer, log in as myself (or the user too, it didn't matter) and the key & value do not exist in the registry.  Do I need to use the "Set 64-bit Registry Value" Step Type to accomplish this?

And I've also tried setting the reg value on a test machine, exporting the Key/Value to a .reg file and creating a .bat file to run the .reg.  Then zipping that up and using this Procedure to push it to a client:

------------------------------------------
<Procedure folderId="77624817617346249177252214" id="2012149051" treePres="3" name="Test to add reg key/value">
<Body description="">
<If description="">
<Condition name="True"/>
<Then>
<Statement name="WriteFile" description="Write the selected file to the machine at the path specified - full path required." osType="Windows" continueOnFail="false">
<Parameter name="Path" value="#vAgentConfiguration.AgentTempDir#\SoftwareFiles\RegTest\reg.zip" xsi:type="StringParameter"/>
<Parameter name="ManagedFile" value="VSASharedFiles\SoftwareFiles\RegTest\reg.zip" xsi:type="StringParameter"/>
<Parameter name="DeleteAfter" value="False" xsi:type="BooleanParameter"/>
</Statement>
<Statement name="Unzip file" description="Unzips a file (Windows, OS X, Linux)" osType="Windows" continueOnFail="false">
<Parameter name="Parameter1" value="#vAgentConfiguration.AgentTempDir#\SoftwareFiles\RegTest\reg.zip" xsi:type="StringParameter"/>
<Parameter name="Parameter2" value="#vAgentConfiguration.AgentTempDir#\SoftwareFiles\RegTest\" xsi:type="StringParameter"/>
<Parameter name="Parameter3" value="True" xsi:type="StringParameter"/>
</Statement>
<Statement name="ExecuteShellCommand" description="Execute the given command as if it were typed in at a command prompt." continueOnFail="false">
<Parameter name="Command" value="#vAgentConfiguration.AgentTempDir#\SoftwareFiles\RegTest\reg.bat" xsi:type="StringParameter"/>
<Parameter name="ExecuteAccount" value="System" xsi:type="EnumParameter"/>
<Parameter name="Is64Bit" value="False" xsi:type="BooleanParameter"/>
</Statement>
</Then>
</If>
</Body>
</Procedure>
------------------------------------------
afnet.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\afnet.achievementfirst.org]
"http"=dword:00000002
"https"=dword:00000002
------------------------------------------
register.bat
@ECHO OFF
regedit /s afnet.reg
cls
------------------------------------------
When I try this it copies the zip file over and unzips it.  But I can't actually tell if it runs the bat file properly or not.  The user cannot make changes to the registry, but that's why I have the shell command run as system account.  When I check the registry, the values are not there.  If I run the bat file manually as an admin it works and I can see the values added right away...
That being said, can anyone tell me why I cannot get  this to work?  I assume I am either approaching this incorrectly, making incorrect assumptions about how some things work, or just leaving something important off accidentally.  Any help would be appreciated.
Thanks!
All Replies
  • Is there really no-one out there that can help with this?  I had been led to believe that this community was extremely knowledgeable and helpful.  Anybody out there?

  • Procedure Set Reg Value.xml

    HI Justin

    First you need to realise that those of us who contribute to these forums do so in our own time , so the length it takes to get a response depends on when we can squeeze it in around our other tasks. In fact .. this reply is been drafted on Sunday morning .. so sometimes it takes a bit of patience.

    To make it easier to trouble shoot your script it is also a good idea to post an actual xml export of the script and any other files. Then we don't have to recreate these on our systems just to test.

    As to your question

    There are existing built in commands within agent procedures to add reg keys so you don't need to download zip files etc.

    Just add the steps directly into your script

    Set64bitRegistryValue or SetRegistryValue

    Using either or depends on your OS being 64bit or not

    So attached is a 4 line sample script that adds these reg keys every time on my system

    Paul