Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user = "admin"
- $pass = "admin123"
- $pair = "${user}:${pass}"
- $fileName = "0.iso";
- $sourceFilePath = "C:\\$fileName";
- $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
- $base64 = [System.Convert]::ToBase64String($bytes)
- $basicAuthValue = "Basic $base64"
- #$headers = @{ Authorization = $basicAuthValue; "Content-Length" = $sourceFilePath.Length } #Err You must write ContentLength bytes to the request stream before calling [Begin]GetResponse.
- $headers = @{ Authorization = $basicAuthValue }
- $uri = "http://nexus.lab.local:8081/nexus/content/sites/myproj/0.iso"
- $output = Invoke-WebRequest -Uri $uri -Headers $headers -Method Post -InFile $sourceFilePath -ContentType "multipart/form-data" -TimeoutSec 36000 -Verbose -Debug
- $Error[0].InvocationInfo.Line
- $output
- Write-Host "###################################"
- $Error[0]
Add Comment
Please, Sign In to add comment