Giter VIP home page Giter VIP logo

Comments (3)

doctordns avatar doctordns commented on June 30, 2024

That indeed would make a good candidate article. Of all the providers, I think the registry is the most difficult to grok, at first.

And at the same time, the original post shows one of the things I am pleased we got right on the blog. And that is the formatting of the code in the older blog articles was sub-optimal! We do better and I hope that that is appreciated.

from community-blog.

mathissuper avatar mathissuper commented on June 30, 2024

Thank you, indeed the formatting of the code in the new blog articles is really appreciated :)
If it could help, here's the function I'm currently using:

function Edit-CompanyRegistry {
  # Adds or edits a registry key whose information is passed as parameters
  # If the key is of type "binary", pass its value in hexadecimal (this function will convert it into binary)
  # Receive the path of the key, its name, type and value
  Param(
    [parameter(Mandatory=$true)] $path,
    [parameter(Mandatory=$true)] $name,
    [parameter(Mandatory=$true)] $type,
    [parameter(Mandatory=$true)] $value
  )
  # If the branch does not exist it is created
  if (!(Test-Path $path)) {
    try { $null = New-Item -Path $path -Force -ErrorAction Stop }
    catch { Write-Host -BackgroundColor DarkRed $Error; exit }
  }
  # If the key is of type "binary", we convert its hexadecimal value into binary
  if ($type -eq 'binary') {
    $hexaValue = $value
    $value = [byte[]](($hexaValue.Split(',')) | % { "0x$_" })
  }
  # Creation of the key if it does not exist, otherwise it is modified
  try { Set-ItemProperty -Path $path -Name $name -Type $type -Value $value }
  catch { Write-Host -BackgroundColor DarkRed $Error; exit }
}

PS: Sorry if my english comments aren't grammatically perfect, it's not my native language and I've simply translate them

from community-blog.

doctordns avatar doctordns commented on June 30, 2024

PR #67 addresses this issue.

from community-blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.