Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create: Get-TssSecretAttachment #44

Closed
wsmelton opened this issue Jan 7, 2021 · 1 comment
Closed

Create: Get-TssSecretAttachment #44

wsmelton opened this issue Jan 7, 2021 · 1 comment
Assignees
Labels
secrets Endpoint tag secrets
Projects

Comments

@wsmelton
Copy link
Contributor

wsmelton commented Jan 7, 2021

Wrapper function to use the following:

  • Get-TssSecret
  • Get-TssSecretField

The general use of getting the field is that object does not contain the actual file name of the attachment. So it will simply output the content of the attachment, or if you provide the OutFile will properly write the contents to the file name (ensuring PDF for example opens right is not invalid).

If a wrapper exists that uses both functions the Items object of a secret (for the field itself) has the Filename value that can be used to write the file out with the proper name.

Example calls:

# Just dump all attachments to the provided path, will write the file name found on the secret field
Get-TssSecretAttachment -TssSession $session -SecretId 34,15,213,90 -Path 'c:\attachments'

The output of the command itself will include a mapping object that will give: Secret Name, FieldName, and Filename. This should make it usable in a way for importing back to another Secret Server secret (I think).

Shortcut method that could also be introduced: GetAttachment() where this finds the isFile item(s) and outputs the object class TssSecretItem

@wsmelton wsmelton self-assigned this Jan 7, 2021
@wsmelton wsmelton added feature request New feature or request secrets Endpoint tag secrets labels Jan 7, 2021
@wsmelton wsmelton added this to To-Do in Secrets via automation Jan 7, 2021
@wsmelton wsmelton added this to the 1.0 Release milestone Jan 7, 2021
@wsmelton
Copy link
Contributor Author

wsmelton commented Jan 7, 2021

Not sure if this would be too far...

$secret = Get-TssSecret ... -Id 54,23,5,7,4,2,5456,4,67

# just output the file item details where isFile
$secret.GetAttachment()

<# 
   another method has an overload that takes a path
   this would call Get-TssSecretField (but would require that the session token is still valid)
#>
$secret.GetAttachment('c:\attachment_directory')

@wsmelton wsmelton removed the feature request New feature or request label Feb 1, 2021
@wsmelton wsmelton modified the milestones: 1.0 Release, 0.5 Release Feb 1, 2021
@wsmelton wsmelton moved this from To-Do to In Progress in Secrets Mar 2, 2021
@wsmelton wsmelton moved this from In Progress to Done in Secrets Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
secrets Endpoint tag secrets
Projects
No open projects
Secrets
  
Done
Development

No branches or pull requests

1 participant