Hello!
You could use Split-Path "https://mycompany.sharepoint.com/sites/Asite/002-122" -Leaf
If the Answer is helpful, please click "Accept Answer" and upvote it.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want get the last part of a URL, how do I get this done? How do I extract just 002-122 from this url https://mycompany.sharepoint.com/sites/Asite/002-122 with PowerShell?
Hello!
You could use Split-Path "https://mycompany.sharepoint.com/sites/Asite/002-122" -Leaf
If the Answer is helpful, please click "Accept Answer" and upvote it.
Maybe this works for you:
$url = 'https://mycompany.sharepoint.com/sites/Asite/002-122'
$url.Split('/')[5]
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten
Hi,
Check out these discussions on this thread about splitting parts of a URL:
https://social.technet.microsoft.com/Forums/ie/en-US/38d06bcb-8842-47af-9d86-166dd4ee97e3/how-do-i-split-a-url?forum=winserverpowershell
Best regards.
**
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.