Hi I'm trying to use the below script for an automated jira backup, although the script is seems to have a lot of errors when i attempt to run it. Has anyone experienced ant issue using this script? Thanks
This value is wrong:
$account='XXXXX.atlassian.net'
From the code, you can see that the script will append ".atlassian.net", therefore it expects only:
$account='XXXXX'
Can you follow me?
Vague question.
What is the problem exactly? Symptoms? Error messages? etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies, was meant to include errors...below.
Invoke-WebRequest : The remote server returned an error: (404) Not Found.
At C:\Backups\Jira\Jira_Bk_New.ps1:64 char:16
+ ... tBackupID = Invoke-WebRequest -Method Get -Headers $header https://$a ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At C:\Backups\Jira\Jira_Bk_New.ps1:70 char:15
+ ... $status = Invoke-RestMethod -Method Get -Headers $header -Uri "http ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At C:\Backups\Jira\Jira_Bk_New.ps1:70 char:15
+ ... $status = Invoke-RestMethod -Method Get -Headers $header -Uri "http ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, this output looks like a lot of important details are trimmed (and replace with "..."). You should give us the complete and precise output.
But, let me ask something. The script has a bunch of configuration parameters in the first lines, to enter the site's name, the user's credentials and such.
Have you actually configured those (at least the first 3) when you try to execute the script? Without setting the correct values for those, it will never work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi , yes I have completed the required variables.
$account = 'XXXXX.atlassian.net' # Atlassian subdomain i.e. whateverproceeds.atlassian.net
$username = 'XXXXX' # username with domain something@domain.com
$token = 'ATATT3xFfGF0XXXXXXXXX
I have created a new copy of the script, the error has changed to the below:
PS G:\Backups\Jira> G:\Backups\Jira\Jira_Bk_New1.ps1
Path is already present
VERBOSE: POST https://XXXXXXX.atlassian.net.atlassian.net/rest/backup/1/export/runbackup with -1-byte payload
You cannot call a method on a null-valued expression.
At G:\Backups\Jira\Jira_Bk_New1.ps1:55 char:9
+ $InitiateBackup = $_.Exception.Response.GetResponseStream()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
\d+ : The term '\d+' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At G:\Backups\Jira\Jira_Bk_New1.ps1:76 char:35
+ if ($status.progress -match "(\d+)") {
+ ~~~
+ CategoryInfo : ObjectNotFound: (\d+:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From the script code you can see, that it will append the ".atlassian.net" suffix to the URL.
Therefore
$account = 'XXXXX.atlassian.net'
should be only:
$account = 'XXXXX'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, updated to:
$account = 'xxxx-staging' # Atlassian subdomain i.e. whateverproceeds.atlassian.net
the script got a bit further then there seems to be something in the code cuasing the error linked with "\d+"
PS G:\Backups\Jira> G:\Backups\Jira\Jira_Bk_New1.ps1
Path is already present
VERBOSE: POST https://xxxxx-staging.atlassian.net/rest/backup/1/export/runbackup with -1-byte payload
VERBOSE: received -1-byte response of content type application/json;charset=UTF-8
\d+ : The term '\d+' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At G:\Backups\Jira\Jira_Bk_New1.ps1:76 char:35
+ if ($status.progress -match "(\d+)") {
+ ~~~
+ CategoryInfo : ObjectNotFound: (\d+:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The next thing that looks strage is:
with -1-byte payload
I can see from the script code that it compiles a JSON for the request body, but -1 suggest that it is not correct.
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.