SOLVED

Extracting the value from a pipeline variable

Brass Contributor

HELP! I am going mad with this!

 

I am trying to enumerate a SharePoint group name using PowerShell. I'm using this:

$SiteMembersGroup = get-pnpsitegroup | where {$_.Title -like "*members"} | select { $_.Title }

Which gives me the output:

$_.Title
----------
AcmeCo Members

 

 

How do I extract JUST the value? I've tried dozens of ways and can't get it to work. There MUST be a simple way right?

Thanks for any pointers!

Matt

2 Replies
best response confirmed by Matt_P_Standing (Brass Contributor)
Solution

@Matt_P_Standing 

 

Hi, Matt.

 

If you don't want it presented as an object, use this format instead, as this will give you just a flattened string value - or a collection of strings if more than one site matches your wildcard specification.

 

 

$SiteMembersGroup = (get-pnpsitegroup | where {$_.Title -like "*members"}).Title;

 

 

Cheers,

Lain

HERO!!!!

Thank you Lain!
1 best response

Accepted Solutions
best response confirmed by Matt_P_Standing (Brass Contributor)
Solution

@Matt_P_Standing 

 

Hi, Matt.

 

If you don't want it presented as an object, use this format instead, as this will give you just a flattened string value - or a collection of strings if more than one site matches your wildcard specification.

 

 

$SiteMembersGroup = (get-pnpsitegroup | where {$_.Title -like "*members"}).Title;

 

 

Cheers,

Lain

View solution in original post