Solved

Coding for variable registry in powersehll

Posted on 2014-10-15
3
148 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

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...
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

626 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