0

I'm looking to import the below registry key without actually importing the .reg file

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Cirrato]
"postInstallExecTimeout"=dword:0000001e
"ConfigApplyAllSettingsForModels"=""
"ConfigApplyAllSettingsForQueueNames"=""
"ConfigApplyPreferencesOnlyForQueueNames"=""
"OURestrictFailureCaption"=""
"OURestrictFailureText"=""

Is it possible to import this key in-line? I can't find any resources demonstrating how to add a registry key with multiple values like this.

4
  • Umm... why? What is the problem you're trying to solve? Commented Dec 13, 2017 at 1:00
  • Crude method would be to store the reg settings in a 'here' string, then write them to a temporary file at execution time and shell to 'regedit' or 'reg' to do the import. Commented Dec 13, 2017 at 1:07
  • I need to create this key as an SCCM configuration item, which means I can't import any files. It must be done entirely through the script. Commented Dec 13, 2017 at 15:10
  • So you don't actually have that .reg file, but want to create the same settings as importing the file would? Commented Dec 13, 2017 at 21:00

1 Answer 1

1

You can easily create a registry key from scratch like this:

$path = 'HKLM:\SOFTWARE\Cirrato'
$path = 'HKCU:\SOFTWARE\foo'

New-Item -Path $path -Force | Out-Null

Set-ItemProperty -Path $path -Name 'postInstallExecTimeout' -Value 30
Set-ItemProperty -Path $path -Name 'ConfigApplyAllSettingsForModels' -Value ''
Set-ItemProperty -Path $path -Name 'ConfigApplyAllSettingsForQueueNames' -Value ''
Set-ItemProperty -Path $path -Name 'ConfigApplyPreferencesOnlyForQueueNames' -Value ''
Set-ItemProperty -Path $path -Name 'OURestrictFailureCaption' -Value ''
Set-ItemProperty -Path $path -Name 'OURestrictFailureText' -Value ''

The registry entries will normally be created with the appropriate type for the input value (REG_DWORD for integers, REG_SZ for strings). If not you can specify the type via the -Type parameter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.