Comments (3)
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.
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.
PR #67 addresses this issue.
from community-blog.
Related Issues (20)
- Post idea...List who has access to an SMB Share HOT 5
- Typo in `Welcome to the Community-Blog contributor guide` HOT 1
- Why use Set-Variable Get-Variable? HOT 1
- Error using Remove-AdminPowerApp in the Microsoft.PowerApps.Administration.PowerShell module HOT 1
- Post idea - The formatting system and some things to be aware of
- Automated testing of tab completion HOT 4
- Clarification about main aim of the powershell-community blog space HOT 2
- Bulk Create Exchange Mailboxes for AD users and configure settings HOT 1
- Request: Check download speed HOT 4
- readme.md - clarify meaning of "classy"
- Post idea - How Can I Be Notified Any Time a Service Goes Down? HOT 7
- Post idea: Permanent Event Handling using Windows WMI and PowerShell HOT 1
- Understanding Active Directory ACL via PowerShell HOT 8
- Using PowerShell for Automation: Running Windows Updates in a vSphere Cluster HOT 2
- Post idea - Using PowerShell and Regular Expressions as a Wordle Solving Tool HOT 2
- Contributing to the blog - need more info HOT 1
- Using Microsoft Graph SDK PowerShell Module
- Restart-computer does not work in VS code HOT 1
- Password Expiry Notification Using Teams and Graph API HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from community-blog.