Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Removing Text

$
0
0

Import-Module Activedirectory

$UserInfo = Get-ADUser Tom. Johnson -Properties MemberOf

ForEach($Member in $UserInfo.MemberOf | Sort-Object $_.MemberOf)

{

        $GroupInfo = Get-ADGroup -Filter {DistinguishedName -eq $Member} -properties info

        If($Groupinfo.info -ne $null -and $GroupInfo.info -match "j:")

        {$GroupInfo.info}

}

 

The above script returns the following. What I would like it to return is only the bolded text. I’ve tried to research how I can do this but have come up with nothing. Please help

 

Owner: Meredith Johnson. Gives access to J:WhitonIT.

Owner: Tom Smith. Gives access to J:Whiton IT\Whiton Role Based Provisioning.

Owner: Sandra Aguirre. Gives access to J:Choice-Tools Resources and maps to M drive (PCHOICEN).

Owner: Todd Sminderg. Gives access to J:/Whiton All/System Logon Instructions_Whiton-UPG.

Owner: Peter Zehr. Gives access to J:WhitonIT\Infrastructure and Outsourcing\IT Services\UPG reports.

 

Again, this is what I would like to have the script to return.

J:WhitonIT.

J:Whiton IT\Whiton Role Based Provisioning.

J:Choice-Tools Resources and maps to M drive (PCHOICEN).

J:/Whiton All/System Logon Instructions_Whiton-UPG.

J:WhitonIT\Infrastructure and Outsourcing\IT Services\UPG reports.

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles