Solved

Coding for variable registry in powersehll

Posted on 2014-10-15
3
145 Views
Last Modified: 2014-10-16
Hi everyone,

Basically, I am trying to disable Adobe updates in registry for Acrobat, Reader or anything that uses the method below. As per adobe documentation:

1. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\{product}\{version}\
FeatureLockdown.
2. Create the new DWord bUpdater.
3. Set the value to 0.

Below is what I think should be the solution and what I have tried. If there is a better way, please let me know.

What I have thought of so far is returning each name in parent ..\Adobe, and for each return the names and in each create the new DWord/set value to zero.

The python-esque/plain english logic would be:

path = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\"

for product in path:
  for version in product:
    finalPath = path + "FeatureLockDown"
    New-Item -Path finalPath bUpdater -Force
    Set-Item -Path finalPath -Value 0

So far, I haven't been able to store the individual products in the paths, let alone iterate, and repeat the process in the child, then set the variables.

The closest I've gotten:
$(Get-childItem HKLM:\SOFTWARE\Policies\Adobe\).Name | foreach {Write-Host $_}

This returns the name on one of my machines where there is only 1 product. When there is 2, it returns blank.

Any help would be greatly appreciated!

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Updates (Removed older updates):

foreach ($product in Get-childItem HKLM:\SOFTWARE\Policies\Adobe\ -Recurse) {
  If ($product.Name.Contains("FeatureLockDown") -and (-Not($product.Name.Contains("FeatureLockDown\")))) {
    Write-Host $product
  }
}

returns "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\{product}\{version}\
FeatureLockdown"
0
Comment
Question by:scsyeg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 40383000
Well, the command to just set one would be like:
New-ItemProperty "HKLM:\SOFTWARE\Policies\Adobe\Acrobat Reader\10.0\FeatureLockDown" -Name bUpdater -propertyType DWORD -Value "0x00000000" -Force | Out-Null

Open in new window


I only have the one product installed, but I think the following would work for multiple.
Get-Item "HKLM:\SOFTWARE\Policies\Adobe\*\*\FeatureLockdown" | New-ItemProperty -Name bUpdater -PropertyType DWORD -Value "0x00000000" -Force | Out-Null

Open in new window

0
 

Author Comment

by:scsyeg
ID: 40383040
That might be a cleaner method than my own that ended up working:

foreach ($product in Get-childItem HKLM:\SOFTWARE\Policies\Adobe\ -Recurse) {
  If ($product.Name.Contains("FeatureLockDown") -and (!($product.Name.Contains("FeatureLockDown\")))) {
    $productPath = $product -replace "HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Adobe\\","HKLM:\SOFTWARE\Policies\Adobe\"
    New-ItemProperty -Path $productPath -Name "bUpdater" -PropertyType "DWORD" -Value 0 -force #-ErrorAction silentlycontinue
  }
}

Open in new window


Which do you like better? Why?
0
 
LVL 40

Expert Comment

by:footech
ID: 40383084
I like mine just because it's cleaner and I like to use the pipeline whenever I can.  There's also not as many operations.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question