Working in the registry with powershell.
Link : https://technet.microsoft.com/fr-fr/library/dd315394.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for remote access use this | |
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer1) | |
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Veritas\\NetBackup\\CurrentVersion") | |
$NetbackupVersion1 = $RegKey.GetValue("PackageVersion") | |
#If you want to set a value, use | |
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Veritas\\NetBackup\\CurrentVersion",$true) | |
then regkey.setvalue("Name","Myvalue") | |
# to access a registry path without a psdrive (hklm: etc.) use the registry provider : | |
cd registry::\HKEY_USERS | |
#view values of a registry key | |
Get-ItemProperty 'registry::\hkey_users\<userSID>\Software\Microsoft\Windows\CurrentVersion\Internet Settings\' | |
#get details for a specific value | |
$regpath='registry::\hkey_users\<userSID>\Software\Microsoft\Windows\CurrentVersion\Internet Settings\' | |
get-itemproperty $regpath -name proxyserver | |
#or just get the value | |
get-itemproperty $regpath | select -expand proxyserver | |
#create a new value | |
New-ItemProperty -Path $regpath -Name PowerShellPath -PropertyType String -Value $PSHome | |
<#propertytype enumeration : | |
Binary (Données binaires) | |
DWord (Nombre UInt32 valide) | |
ExpandString (Chaîne pouvant contenir des variables d'environnement qui sont développées de manière dynamique) | |
MultiString (Chaîne multiligne) | |
String (Valeur de chaîne quelconque) | |
QWord (8 octets de données binaires) | |
#> | |
#remove a value | |
Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name PSHome |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment