/build/static/layout/Breadcrumb_cap_w.png

K2000 Batch File to Add Registry Keys

Hey all,

I've been working on a batch file to add registry keys to both HKLM and HKU (for the default profile) and just recently got the batch script to work, but I needed an elevated cmd prompt when I was doing it within windows and when I attempt to just run the batch file from the K2000 during the scripted install the settings aren't applied, what am I missing here?? I feel like I'm so close!!

Here's the batch file contents:
reg load HKLM\temphive C:\users\default\NTUSER.DAT
reg import %~dp0HKCUReg.reg
reg unload HKLM\temphive
reg import %~dp0HKLMReg.reg

And then I was just having a Postinstall task of:
Name: RegistryEdits
Type: Application
Runtime Environment: Windows
File: RegBatch.zip  (this has the 2 registry files and that batch file in it)
Command line: RegBatch.bat

Reboot Required is checked (because one of them is to disable UAC)

I've tried unchecking the reboot required as well. And as a note the image is Win7SP1x86

Please help!

0 Comments   [ + ] Show comments

Answers (2)

Posted by: k1000-chan 9 years ago
Senior White Belt
2
I've run into this issue as well where reg will just not work, even with UAC off. The approach I take is to create a .reg file with all of the changes and then load it using: 

regedit /s file.reg

For more complicated registry editing I've also used AutoIT to create an exe that can silently run and do its thing. AutoIT is a bit more flexible for editing the reg than a batch file. After that It's easy to wrap it all in SFX Maker to build a quick installer.

Comments:
  • How are you adding it to the K2000? As an application? As a batch file? And I'm really needing this to load the default registry and add these registry keys, thus the batch file. Thanks! - khorvath 9 years ago
    • I do not use a K2000 for deployment so I'm not sure how you would set it up. You can run that command from a batch file. I am thinking you would need to create .reg files for all of your reg changes, then create a batch file with the command above to load each of the .reg files in. Zip it up and upload it to the post deployment task.

      There are tons of way to get this done though. I find with the K1, it's easiest sometimes just to make an exe for it to run. This is where AutoIT is my best friend. - k1000-chan 9 years ago
      • Annnnnd what you're suggesting is what I am doing and what is not working! Unfortunately I need it to be a post-install task as a part of the image, can't really use the K1000 for this particular instance. :-) Although I do love our K1000 for other things! - khorvath 9 years ago
      • My assumption from past experience is that the REG command you are using is the problem. You tried using regedit /s and it still failed? - k1000-chan 9 years ago
    • Couldn't you create a smart label on the K1 to detect computers with a windows install time of X (within the past hour or whatever) and then have it push the managed install down to the pc along with whatever other things?

      That way you wouldn't need to munge around on the K2 for a post-install task - since it'd technically be post-install shortly enough after the first inventory after the kbot is installed and does it's first run? - JKlank 9 years ago
      • I've done this on the K1. It is possible. You need to reference OS_INSTALLED_DATE. In my case I made it so any computer with Windows 7 installed in the last 2 hours would run a bunch of managed installs.

        Script: http://appdeploylive.com/question/create-smart-label-based-on-agent-connection-time#sthash.EEh82qmR.dpuf - k1000-chan 9 years ago
  • I have tried the reg /import as well as regedit /s and neither appears to apply the settings :-( - khorvath 9 years ago
    • Does the post install script run as the system user? - k1000-chan 9 years ago
      • I have no idea, there's no option for this. I'm really hoping someone can help who's familiar with how the K2000 works because I know people have done this before with images. - khorvath 9 years ago
Posted by: breanne 9 years ago
Senior White Belt
1
I usually do it by zipping a reg with a bat file and then call the bat as a K2000 application.
For instance, I will have example.bat as the command line, and inside example.bat would be:
   reg import example.reg
I usually do this because in the same bat I'll have a bunch of file copies as well.

Alternatively, you could write a VB script to make a registry change and then call it with cscript.exe as a K2000 application.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ