Skip to content

Instantly share code, notes, and snippets.

@BeanCounterTop
Created March 4, 2016 07:50
Show Gist options
  • Save BeanCounterTop/5a90de93a8298eabcdff to your computer and use it in GitHub Desktop.
Save BeanCounterTop/5a90de93a8298eabcdff to your computer and use it in GitHub Desktop.
Function Store-Object($Object, $BucketName, $Key) {
$ObjectFilePath = "$env:temp\object$(get-random).xml"
$Object | Export-Clixml -Path $ObjectFilePath
Write-S3Object -BucketName $BucketName -File $ObjectFilePath -Key $Key
Remove-Item $ObjectFilePath
}
Function Retrieve-Object ($BucketName, $Key) {
$ObjectFilePath = "$env:temp\object$(get-random).xml"
Read-S3Object -BucketName "clixml" -Key $BucketName -File $ObjectFilePath
$ReceivedObject = Import-Clixml $ObjectFilePath
Remove-Item $ObjectFilePath
Return $ReceivedObject
}
Store-Object -object (GCI 'C:\Program Files (x86)') -BucketName "clixml" -Key "root"
$Object = Retrieve-Object -BucketName "clixml" -Key "root"
$Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment