$username = "admin" $password = " PASSWORD123 " $password_base64 = ConvertTo-SecureString $password -AsPlainText -Force $creds = New-Object System.Management.Automation.PSCredential ($username, $password_base64) $fileName = ".\test3.csv" $uri = "https://epo:8443/rest/dlp/userInfo/import" $currentPath = Convert-Path . $filePath="$currentPath\$fileName" $fileBin = [System.IO.File]::ReadAlltext($filePath) $boundary = [System.Guid]::NewGuid().ToString() $LF = "`r`n" $bodyLines = ( "--$boundary", "Content-Disposition: form-data; name=`"importFile`"; filename=`"$fileName`"", "Content-Type: application/octet-stream$LF", $fileBin, "--$boundary--$LF" ) -join $LF Invoke-RestMethod -Uri $uri -Method Post -Credential $creds -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $bodyLines