Forum Discussion

Matt_P_Standing's avatar
Matt_P_Standing
Brass Contributor
Feb 22, 2024
Solved

Extracting the value from a pipeline variable

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

  • 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

2 Replies

  • LainRobertson's avatar
    LainRobertson
    Silver Contributor

    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

Resources