Link to home
Start Free TrialLog in
Avatar of Patrick de Gelder
Patrick de GelderFlag for Netherlands

asked on

How to create a registry Subkey containing the hostname

I am in need  of some assistance by creating a script that creates a subkey in the registry that contains the hostname:  

example:
[HKLM\Software\Greening\FMP@'hostname']

The hostname needs to be replace by the computer name

Something like in the following steps

- Detect hostname
- Set hostname
- Create registry sub-key.
Avatar of oBdA
oBdA

reg.exe add "HKLM\Software\Greening\FMP@%ComputerName%"

Open in new window

Avatar of Patrick de Gelder

ASKER

Thanks it seems to do the trick...  
Well applied this yesterday on another system and kept generated an error on me.
It needs to be started from an elevated prompt, otherwise you'll get an "Access Denied" because you're writing to HKLM.
C:\Users\firstcare\Desktop>reg.exe add "HKLM\WOW6432Node\HSB Cards & Card Systems\NHIS-HP\Sources\HPVerification\HPVerification@DESKTOP-GFN7MF9"
ERROR: The parameter is incorrect.

This is the error i got
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Stupid mistake glade you help me checking the code
Thanks good one