registry keys in variables

This topic contains 2 replies, has 2 voices, and was last updated by  Andreas 3 weeks ago.

  • Author
    Posts
  • #103553

    Andreas
    Participant

    Hi,

    i´m trying to read some keys from the registry, save them in a variable for using them.
    (scanning a complete network for installed Programs, this is only a small part of it)

    $varName = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | select Name;
    $varName;
    foreach ($Prog in $Varname){
        get-childitem $Prog | select Name
    }
    

    for me as a PS beginner i can´t imagine why there is ny working path in front of the $Prog when using it in foreach f.e. c:\Windows\system32\@{Name=hklm.....

    I hope you can help me

    Andreas

  • #103555

    Olaf Soyk
    Participant

    If you do not specify a complete path Powershell uses the current directory to complete the path. If I got you right you#re looking for something like this:

    $varName = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ 
    foreach ($Prog in $Varname){
        Get-ItemProperty $Prog.PSPath
    }

    or this

    Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*\
  • #103567

    Andreas
    Participant

    The one solution with $Prog.PSPath is the one i was looking for 🙂 thx
    I need to know all installed software its display name and version nummer and now i can get it

You must be logged in to reply to this topic.