Skip to content

Registry meta-resource #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SteveL-MSFT opened this issue Jul 14, 2023 · 0 comments
Open

Registry meta-resource #102

SteveL-MSFT opened this issue Jul 14, 2023 · 0 comments
Labels
Issue-Enhancement The issue is a feature or idea
Milestone

Comments

@SteveL-MSFT
Copy link
Member

SteveL-MSFT commented Jul 14, 2023

Summary of the new feature / enhancement

There may be a large set of applications on Windows that store their configuration in the registry. It may make sense to have the registry resource accept a file that maps registry locations to a resource definition.

Proposed technical implementation details (optional)

For example, PS7 uses two registry values to control Microsoft Update:

HKLM\Software\Microsoft\PowerShellCore\UseMU = 1
HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\39243d76-adaf-42b1-94fb-16ecf83237c8\Install = 1

The first enables updating via MU and the second installs if not installed (update doesn't do anything if not installed).

The registry resource could have parameters like registry -resourceFile ps7.json which contains:

{
  "name": "PowerShellMicrosoftUpdate",
  "version": "1.0.0",
  "properties": {
    "automaticUpdates": {
        "key": "HKLM\Software\Microsoft\PowerShellCore",
        "name": "UseMU",
        "valueType": "DWORD",
        "values": [ 0, 1 ]
    },
    "automaticInstall": {
        "key": "HKLM\Software\Microsoft\PowerShellCore\InstalledVersions\39243d76-adaf-42b1-94fb-16ecf83237c8",
        "name": "Install",
        "valueType": "DWORD",
        "values": [ 0, 1 ]
    }
  }
}

This is hypothetical and the values property needs to be thought out on how to properly support this. Also, for the registry resource to synthesize a DSC resource, it would need to generate JSON schema or implement the validate subcommand and perform its own validation against the incoming JSON (this seems more feasible).

Each synthetic resource would need it's own resource manifest that uses the registry resource.
In this example, imagine a microsoft.powershell.microsoftupdate.dsc.json file in a location either the registry resource
is aware of or in the same location as registry.exe:

{
  "manifestVersion": "1.0",
  "type": "Microsoft.PowerShell/MicrosoftUpdate",
  "version": "0.1.0",
  "get": {
    "executable": "registry",
    "args": [
      "get",
      "--resourceFile",
      "microsoft.powershell.microsoftupdate.json"
    ],
    "input": "stdin"
  },
  "set": {
    "executable": "registry",
    "args": [
      "set",
      "--resourceFile",
      "microsoft.powershell.microsoftupdate.json"
    ],
    "input": "stdin"
  },
  "test": {
    "executable": "registry",
    "args": [
      "test",
      "--resourceFile",
      "microsoft.powershell.microsoftupdate.json"
    ],
    "input": "stdin"
  },
  "validate": {
    "executable": "registry",
    "args": [
      "validate",
      "--resourceFile",
      "microsoft.powershell.microsoftupdate.json"
    ],
    "input": "stdin"
  },
  "exitCodes": {
    "0": "Success",
    "1": "Invalid parameter",
    "2": "Invalid input",
    "3": "Registry error",
    "4": "JSON serialization failed"
  }
}
@SteveL-MSFT SteveL-MSFT added the Issue-Enhancement The issue is a feature or idea label Jul 14, 2023
@michaeltlombardi michaeltlombardi added this to the Post-3.0 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement The issue is a feature or idea
Projects
None yet
Development

No branches or pull requests

2 participants