We help IT Professionals succeed at work.
Get Started

Powershell - Get values between brackets

amaru96 asked
Last Modified: 2015-04-13
Hi guys, I'm running the below command which shows me a list of updates within a group.

Get-CMSoftwareUpdate -UpdateGroupName group1 | select LocalizedDisplayName

The result looks something like this:
Security update for Windows 7 (KB123456)
Security update for Windows 7 (KB123456)
Security update for Windows 7 (KB123456)
Security update for Windows 7 (KB123456)
Security update for Windows 7 (KB123456)
Security update for Windows 7 (KB123456)

What I'd like is the list of KB numbers instead of the entire name of the update.

Like this, without the brackets:

How would I go about getting these values? I tried using .split but don't really know what I'm doing and didn't get anywhere.

Also, a small number of results don't have KB numbers, so it would be great if the script listed that result as "No KB" or something similar.
Watch Question
Most Valuable Expert 2019
Most Valuable Expert 2018
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE