PoshCode Logo PowerShell Code Repository

GET-Remoteapps by Sean Kearney 17 months ago
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/2121"></script>download | new post

Find an Application on remote list of computers.

Example for Accessing Registry remotely comes from MOW from a blog posting here http://thepowershellguy.com/blogs/posh/archive/2007/06/20/remote-registry-access-and-creating-new-registry-values-with-powershell.aspx

  1. # Original posting on how to access a remote Registry from The Powershell Guy
  2. #
  3. # http://thepowershellguy.com/blogs/posh/archive/2007/06/20/remote-registry-access-and-creating-new-registry-values-with-powershell.aspx
  4. #
  5. # This script will Query the Uninstall Key on a computer specified in $computername and list the applications installed there
  6. # $Branch contains the branch of the registry being accessed
  7. #  '
  8.  
  9. # format of Computerlist.csv
  10. # Line 1 - NameOfComputer
  11. # Line 2 etcetc etc etc etc An Actual name of a computer
  12.  
  13. $COMPUTERS=IMPORT-CSV C:\Powershell\Computerlist.csv
  14.  
  15. FOREACH ($PC in $COMPUTERS) {
  16. $computername=$PC.NameOfComputer
  17.  
  18. # Branch of the Registry
  19. $Branch='LocalMachine'
  20.  
  21. # Main Sub Branch you need to open
  22. $SubBranch="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
  23.  
  24. $registry=[microsoft.win32.registrykey]::OpenRemoteBaseKey('Localmachine',$computername)
  25. $registrykey=$registry.OpenSubKey($Subbranch)
  26. $SubKeys=$registrykey.GetSubKeyNames()
  27.  
  28. # Drill through the list of SubKeys and examine the Display name
  29.  
  30. Foreach ($key in $subkeys)
  31. {
  32.     $exactkey=$key
  33.     $NewSubKey=$SubBranch+"\\"+$exactkey
  34.     $ReadUninstall=$registry.OpenSubKey($NewSubKey)
  35.     $Value=$ReadUninstall.GetValue("DisplayName")
  36.     Write-Host $computername, $Value
  37.  
  38. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me