Link to home
Start Free TrialLog in
Avatar of MGS-TECH
MGS-TECH

asked on

Registry Subkey Count In Powershell

What is the correct syntax for getting a registry subkey count in Powershell, and if that count passes the If statement, then continue.
I am testing this to see if an Outlook profile has not been setup on this computer than continue, otherwise end script

Here is what I have so far:

Get-ChildItem "hkcu:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
[string]$regKeys = Get-ChildItem "hkcu:\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"

If ($regKeys._GetSubKeyCount -lt 5)
      {      
            'Outlook is setup on this computer'
}
Else
      {      
            'Outlook is not setup on this Computer'
}




I don't believe that I have the ._GetSubKeyCount syntax correct. Please advise.
ASKER CERTIFIED SOLUTION
Avatar of jostrander
jostrander
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial