locked
How to make sure Registry Edit value is on a all the machines on my network? Powershell RRS feed

  • Question

  • Hi,

    We have Dropbox on all our machines and we have a db.reg that syncs the user's profiles to Dropbox so the whole profile is backed up. Unfortunately, not all the machines are getting the DB.reg executable. So is there a script that I can use to search for the windows registry editor for those values and sent back a report to me, once they hit the network?

    Thanks. 


    • Edited by HA_support_tm Tuesday, December 11, 2018 12:03 AM
    • Moved by Bill_Stewart Monday, July 29, 2019 7:59 PM Off-topic/unanswerable drive-by question
    Monday, December 10, 2018 11:56 PM

All replies

  • You should use group policies to maintain a certain registry setting for all users - there's no script needed. Regardless of that:

    Please read this first: This forum is for scripting questions rather than script requests.

    Also find scripts here: PowerShell Gallery or here: TechNet Gallery - resources for IT professionals.

    Learn PowerShell: Microsoft Virtual Academy - Getting Started with Microsoft PowerShell.

    Script requests: Microsoft Technet Script Center - Requests.


    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Tuesday, December 11, 2018 1:07 AM
  • Lucky you, I got this already done so thought I would share. Just change the Key path and Key your're looking for and produce a file with a list of machines to check.

    http://scriptsbyscott.com/Get-Registry.html

    <#
    	.Synopsis
    	Scott Head | 11/28/2018 12:33:03 PM
    	.DESCRIPTION
    		Gets a list of servers from source text file. Tests the path to the key and pulls key value.
    		Returns the Key Value and the ComputerName
    		Also has error tapping built in and error messages.
    
    	.EXAMPLE
    		Script has to ran with elevated rights on the Domain / Loca Admin Rights to access all servers.
    
    		 Mandatory File - C:\temp\ServerList.txt
    		 Mandatory Dir  - C:\temp
    	#>
    
    	$Server=Get-Content C:\temp\ServerList.txt
    
    	$MyCommand={    
    
    		#||||||||||||||||||||| Set Inital Key Path ||||||||||||||||||||
    		$Path1="HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\Hotmail"
    
    		#||| Test Key Path |||
    		If(Test-Path $Path1){
    			#||| Error Trapping |||
    			Try{
    
    					#|||||||||||||||||||||||||||||||| Get Value for Specified Key |||||||||||||||||||||||||||||
    					$MyKeyReturned=Get-ItemProperty $Path1 | Select Object -ExpandProperty "LocalizedString" -ErrorAction stop
    
    					#||||| Set up old School Object for Backward Compatibilty to 2.0 for Returning Data ||||||
    					$Obj=New-Object PSObject 
    					$Obj |Add-Member NoteProperty ServerName ($Env:Computername)
    					$Obj |Add-Member NoteProperty ReturnedKey ($MyKeyReturned)
    					Return $Obj  
    
    				}Catch{
    
    					#||||| Set up old School Object for Backward Compatibilty to 2.0 for Returning Data ||||||
    					$Obj=New-Object PSObject 
    					$Obj |Add-Member NoteProperty ServerName ($Env:Computername)
    					$Obj |Add-Member NoteProperty ReturnedKey ($_.Exception)
    					Return $Obj 
    
    
    				}
    		}else{
    
    					#||||| Set up old School Object for Backward Compatibilty to 2.0 for Returning Data ||||||
    					$Obj=New-Object PSObject 
    					$Obj |Add-Member NoteProperty ServerName ($Env:Computername)
    					$Obj |Add-Member NoteProperty ReturnedKey ("Key Access-Failed")
    					Return $Obj 
    		}
    
    	}
    
    		#||| Error Trap |||||
    		Try{
    
    		   Invoke-Command -ComputerName $Server -ScriptBlock $MyCommand -ErrorAction Stop | Select-Object -Property * -ExcludeProperty RunspaceId, PSComputerName
    
    		}Catch{
    
    			$_.Exception
    
    		}
    
    
    			
    			

    • Proposed as answer by ComputerScott Tuesday, December 11, 2018 5:27 AM
    Tuesday, December 11, 2018 5:27 AM