Hi all, im trying to download via powershell to make an automatic task every friday. Im using this script but it stays at the login page.
I have made many scripts but none of them worked as i want, they download me the login page.
$webClient = new-object System.Net.WebClient
$creds = New-Object System.Net.NetworkCredential ("user", "password")
$url = "http://localhost:8080/sr/jira.issueviews:searchrequest-excel-all-fields/10000/SearchRequest-10000.xls?"
$localfilename = "C:\Users\mminguel\Documents\WorkLog2.xls"
$cache = new-object System.Net.CredentialCache
$cache.Add($url, "Basic", $creds)
$webclient.Credentials = $cache
$webClient.DownloadFile($url, $localfilename)
or
$source = "http://localhost:8080/sr/jira.issueviews:searchrequest-excel-all-fields/10000/SearchRequest-10000.xls"
$destination = "C:\Users\mminguel\Documents\WorkLog4.xls"
Invoke-WebRequest $source -OutFile $destination
Thanks!
Community moderators have prevented the ability to post new answers.
This is what I use to do JIRA API querying via PowerShell:
function Encode-Credentials([string]$username, [string]$password) { $credentials = "{0}:{1}" -f $username, $password $bytes = [System.Text.Encoding]::UTF8.GetBytes($credentials) return [System.Convert]::ToBase64String($bytes) } $url = "<url>?jqlQuery=project in (project1, `"project two`") and sprint in openSprints()&tempMax=1000" $request = [System.Net.WebRequest]::Create($url) $request.ContentType = "application/json" $request.Method = "GET" $credentials = Encode-Credentials -username "me" -password "mypassword" $request.Headers.Add("Authorization", "Basic " + $credentials) $response = $request.GetResponse() $stream = $response.GetResponseStream() $sr = New-Object System.IO.StreamReader $stream $sr.ReadToEnd() | Out-File C:\Path\file.xls
Hope that helps.
Confirmed this works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
Where you put the url in your code ?
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.