Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to exclude characters from cell, while creating a CSV file,

$
0
0

I am new to scripting.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
Import-PSSession $Session
Search-AdminAuditLog -UserIds User1,User2,User3 | Select-Object ObjectModified,CmdletName,CmdletParameters,Caller | Export-Csv \\Server\path\Reports\admin_audit$((Get-Date).ToString(' MM-dd-yyyy')).csv  
Remove-PSSession $Session

The output file "admin_audit(date).csv" has 4 columns, ObjectModified, CmdletName, CmdletParameters,and Caller.

In the Caller column, it puts the path for the user in each cell.

namprd04.prod.outlook.com/Microsoft Exchange Hosted Organizations/international.onmicrosoft.com/User1

namprd04.prod.outlook.com/Microsoft Exchange Hosted Organizations/international.onmicrosoft.com/User1
namprd04.prod.outlook.com/Microsoft Exchange Hosted Organizations/international.onmicrosoft.com/User3
namprd04.prod.outlook.com/Microsoft Exchange Hosted Organizations/international.onmicrosoft.com/User2

namprd04.prod.outlook.com/Microsoft Exchange Hosted Organizations/international.onmicrosoft.com/User3

I want to remove everything from the first "N" to the last /, and exclude the Username (User1,2,3). The text in bold.

thanks




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>