Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
Former Member
3 years agoExport specific data from vault
Hello, any help would be greatly appreciated on this. I have to export a list of logins from a specific Vault as part of a divestiture with the company I work for. I have been attempting to pull the data in a way that I get the Title and the Username for now (I will need to export this to a csv but need to get the data returned for now). However, I cannot get the data I am wanting.
```
function Get-1passworditems {
[CmdletBinding()]
param ([Parameter(Mandatory=$true)][string]$vaultuuid)
#Set Console Encoding
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
#Ensure variables are empty and ready to go
$results = @()
$id =@()
$data =@()
$item = @()
#Get Initial list of item uuids
$results = op item list --vault $vaultuuid --format=JSON
#Convert from JSON to powershell objects
#$data = $results | ConvertFrom-Json
$id = $results.id
Write-Host "Starting foreach" -ForegroundColor Green
foreach($item in $id){
$item
& $op item get $item --vault $vaultuuid --field username
}
}
```
If I attempt to convert the data using ConvertFrom-JSON (as per another discussion I saw here), I get all kinds of errors. I know there is something I am missing here, but am not sure what. Attempts to use the desktop app to export that specific vault is not working in a way that I can safely say its specific to that vault and not a full export of the 40+ vaults we have.
1Password Version: Desktop 8.7.3, CLI 2.5.1
Extension Version: Not Provided
OS Version: Win 10
Browser:_ Not Provided
- Former Member
Just wanted to drop by to let you know that we have just released v2.11.0 of 1Password CLI, which should address this issue. See Update to the latest version of 1Password CLI for instructions on how to update.
Let us know if you are still having issues with v2.11.0 or later.
- Former Member
Thank you for your detailed diagnostics and your time!
We have an internal ticket tracking all the reports that we receive, related to this.
We'll make sure to post an update as soon as we'll have any developments on this.Best,
Horia - Former Member
The code I executed on my personal MacBook ran flawlessly. It seems that the 1password CLI in Windows is flawed to the point I have issue using it - which is disappointing because my team is PC only. I look forward to the fix to the Windows libraries so that i can utilize this on my work PC moving forward.
- Former Member
Thanks @jwilson5607
We're going to start looking into this by trying to reproduce it on a Windows binary on a vault with many items. After some digging around, it turns out we've had the same error reported on another Windows system user with lots of items in their vault - so you are not alone in seeing this error.
I am not quite sure if you have a timeline on fixing this error due to the divesture from your current company, but because the fix for this error is quite undefined at this point, I would advise trying to circumvent the error by adding a longer sleep, or trying to use op on a different platform, like mac or linux OSs for example.
- Former Member
Attached a few as files here along with a new one @"Justin.Yoon_1P"
- Former Member
There is no discernable pattern to it either. Sometimes its every other one, sometimes it will go quite a few and then hit one or more of these errors. If I need to attach the errors in another way because they are too hard to read - let me know.
- Former Member
Running it with a second delay on each loop gives me the same errors as before. I did manage to capture a few others as well, as shown here.
- Former Member
Hey @jwilson5607
Yes, I have biometrics turned on and allowed the auth. I do NOT get prompted again while its running the pipeline though.
This should not cause any error states in that case - this has to be a bug on our end, are you running into it consistently?
Also I'm not sure if you caught the added questions in the edit of my last message:
Are you still running into issues without the sleep statement? How about with it on, but around 1 second?
Is it the same error as earlier, or a general 429 rate limited one?Lastly, I've just tested your new script and can confirm that there are no issues with it (I didn't test the Excel export part, but printing the
$results
variable looked good to me). - Former Member
Yes, I have biometrics turned on and allowed the auth. I do NOT get prompted again while its running the pipeline though.
I noticed that you had both instances set with and without the = sign and wanted to make sure there was no difference.
- Former Member
Hey again @jwilson5607 ,
Why am I getting random errors like those pictured
I've taken a look at the stack, and it looks like it's erroring out in the biometric auth process, in which case, concurrent attempts to send info through a named pipe may have caused the error. Do you have biometric auth turned on, and if so, has
op
been authorized before running the script?Also, this is not an ideal error message. It is the result of an unhandled error causing a panic and is not very readable or understandable. I will be treating it as a bug report once we figure out why it's being printed.
Plus, is there a difference with --format=json and > --format json?
No, there is not! I did notice, however, that the flag was missing in the
$vaultname = op vault get $vaultuuid
command, which is why I suggested it in my last post.Edit: I just took a look at your updated script, and it looks good to me, I will test it on my end tomorrow and get back to you.
Are you still running into issues without the sleep statement? How about with it on, but around 1 second?
Is it the same error as earlier, or a general 429 rate limited one?Thanks for your info so far!!