Currently, I am using PowerShell version 5.1 in Sitecore 10 and attempting to use the cmdlet Receive-File in below script
$tempFolder = "D:\temp\upload"
$filePath = Receive-File -Path $tempFolder -overwrite
if($filePath -eq "cancel"){
exit
}
$importData = Import-CSV $filePath
$rowsCount = ( $importData | Measure-Object ).Count;
if($rowsCount -le 0){
Remove-Item $filePath
Write-Host "No Record found";
exit
}
Write-Log "Bulk Update Started!";
but here $filePath is not returning the file path by using Receive-File. It works if directly gives file path but need to fetch from upload file option (Receive-File). Any assistance would be greatly appreciated.
Please refer https://sitecore.stackexchange.com/questions/35321/okclick-method-through-reflection-is-not-allowed-error-with-spe for it, it have the fix, you can add these config details and it should be working then.
It can either be a separate patch file as mentioned in the link or you can add new config with this detail and add into your custom config folder.