Adding some code to Powershell to remove value

Hi All,

I am not familiar with powershell at all, and i was hoping to get some guidance in my learning.

I have a URL which comes through as part of the script to download from sharepoint and put it in a location.

What im not sure about - is where do i put this code where i want it to strip text from a URLstring.

the URL is http://xxx.com/yyy/file.pdf?csf=1xxxxxx

Where in the below code would it be best to place it and what would be the best command?

Do i use a -replace ?* or what would be the best function for this?

# direct link to PDF
$outputPath = $fullUrl
$outputFile = Split-Path $outputPath -leaf
write-host "status 200 so in here and and my filename is $outputFile"
[Byte[]] $200FilePdfPart = $File.Content[0..6]
write-host "200 first 6 of file.content '$200FilePdfPart'"

$MimeType = $(Get-MimeType -CheckFile $File.Content)
}

if($MimeType -eq "file")
{
# log
Add-content $Logfile -value "File isn't PDF - $fullUrl"
} elseif($MimeType -eq "doc")
{
# log
Add-content $Logfile -value "File is a Word Document .doc - $fullUrl"
} elseif($MimeType -eq "docx")
{
# log
Add-content $Logfile -value "File is a Word Document .docx - $fullUrl"
} elseif($MimeType -eq "jpg")
{
# log
Add-content $Logfile -value "File is a JPG - $fullUrl"
}
else
{
Write-Host " "
Write-Host "Saving PDF - $fullUrl"
# clean up the download path
$DownloadPathandName = $DownloadPath + $outputFile
$DownloadPathandName = $DownloadPathandName -replace "%20"," "
$DownloadPathandName = $DownloadPathandName -replace "t|n|`r",""
$DownloadPathandName = $DownloadPathandName -replace "&","&"

 

Apologies if this is not allowed and remove if required.

 

Cheers