Get-CloudStorage Cmdlet
Parameters Output Objects Configuration Settings
The Get-CloudStorage cmdlet is used to download files and retrieve directory listings from Cloud Storage providers.
Syntax
Get-CloudStorage [parameters]
Remarks
To list a directory, set the List parameter to the remote path of the target directory. Passing "/" as the List parameter will list the root directory of the remote host.
To download files or entire directories, set the RemoteFile parameter to the name of the target file or directory. Wildcards (*) can be used to download multiple files. When downloading multiple files or a directory, the LocalFile parameter must be set to the local directory where the target files/directory should be stored. When downloading a single file, the LocalFile parameter must be set to the local path and file name to the file where the downloaded content will be stored. If the local file already exists, the Overwrite switch must be passed to overwrite the local file.
The following cloud storage providers require OAuth authentication:
- Box
- DropBox
- GoogleDrive
- OneDrive
For each of these providers, OAuthClientId and OAuthClientSecret are required to generate the OAuth token. The cmdlet will automatically fetch and cache OAuth tokens, which requires user-interaction the first time. Once the token has been cached the cmdlet will automatically use and refresh this token without additional interaction. The OAuthCacheDir parameter governs the location of the OAuth cache files, and passing the empty string to this parameter will disable OAuth caching entirely.
Service providers that do not require OAuth authentication have dedicated parameters for the necessary account credentials:
- Amazon S3: AmazonS3AccessKey and AmazonS3SecretKey
- Wasabi: WasabiAccessKey and WasabiSecretKey
- Azure Blob: AzureAccount and AzureBlobAccessKey
- SharePoint: SharePointUser, SharePointPassword, and SharePointURL
The cmdlets support pipeline input for some of their parameters. Prebuilding an object and piping it to the cmdlet is very useful, but should be used with caution to prevent security conflicts. Steps have been taken to decrease the risk of a possibly accidental pipe to the cmdlet, for instance, the Credential parameter cannot be piped to the cmdlet and must be specified manually.
#list all buckets (the root directory) for Amazon S3
Get-CloudStorage -ServiceProvider Amazons3 -AmazonS3AccessKey $accesskey -AmazonS3SecretKey $secretkey -List
"/"
#download all text files from a subfolder of Box
Get-CloudStorage -ServiceProvider Box -OAuthClientId $boxid -OAuthClientSecret $boxsecret -RemoteFile
"test/*.txt"
-LocalFile
"C:/test"
#download a single file from Wasabi
Get-CloudStorage -ServiceProvider Wasabi -WasabiAccessKey $accesskey -WasabiSecretKey $secretkey -RemoteFile
"Apple.txt"
-LocalFile
"C:/test/downloaded_apple.txt"
#download an entire directory from DropBox
Get-CloudStorage -ServiceProvider DropBox -OAuthClientId $dropboxid -OAuthClientSecret $dropboxsecret -RemoteFile
"folder/subfolder"
-LocalFile
"C:/test"
Connection Handling
This cmdlet supports persistent connections through the Connection parameter. To establish a new CloudStorage connection, use the Connect-CloudStorage cmdlet. To close the connection, use the Disconnect-CloudStorage cmdlet.
Parameter List
The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.
Connection | An already established connection. |
LogFile | The location of a file to which debug information is written. |
AmazonS3AccessKey | Account credential for Amazon S3. |
AmazonS3SecretKey | Account credential for Amazon S3. |
AzureAccount | Credential for the Azure Blob service. |
AzureBlobAccessKey | Credential for the Azure Blob service. |
CertPassword | The password to the certificate store. |
CertStore | The name of the certificate store for the client certificate. |
CertStoreType | The type of certificate store for the client certificate. |
CertSubject | The subject of the certificate used for client authentication. |
Config | Specifies one or more configuration settings. |
Credential | The PSCredential object to use for user/password authentication. |
DigitalOceanAccessKey | Account credential for DigitalOcean. |
DigitalOceanSecretKey | Account credential for DigitalOcean. |
EncryptionAlgorithm | The encryption algorithm. |
EncryptionPassword | The encryption password. |
Force | Forces the cmdlet to accept the default behavior instead of querying the user. |
List | Get a directory listing for the path and file mask specified. |
LocalFile | The local file to download to. |
LogFile | The location of a file to which debug information is written. |
OAuthCacheDir | The directory where OAuth settings will be stored. |
OAuthClientId | Account credential for services that require OAuth authentication. |
OAuthClientSecret | Account credential for services that require OAuth authentication. |
OAuthWebServerPort | The port on the local machine where the OAuth web server will listen. |
Overwrite | Indicates whether the LocalFile may be overwritten. |
RemoteFile | The name of the remote file(s)/directory to download. |
RemotePath | The path on the server. |
ServiceProvider | The storage service provider. |
SharePointPassword | Account credential for SharePoint. |
SharePointURL | Account credential for SharePoint. |
SharePointUser | Account credential for SharePoint. |
Timeout | The maximum time allowed for the operation. |
WasabiAccessKey | Account credential for Wasabi. |
WasabiSecretKey | Account credential for Wasabi. |
Output Objects
The following is the full list of the output objects returned by the cmdlet with short descriptions. Click on the links for further details.
EntryInfo | This object contains details about a file returned from the Cloud Storage provider. |
Configuration Settings
The following is a list of configuration settings for the cmdlet with short descriptions. Click on the links for further details.
DateFormat | The date format of the file time. |
DocsExportFormat | The file format to export Google Docs files as when downloading. |
DrawingsExportFormat | The file format to export Google Drawings files as when downloading. |
SheetsExportFormat | The file format to export Google Sheets files as when downloading. |
SlidesExportFormat | The file format to export Google Slides files as when downloading. |
NormalizedFileName[i] | The normalized file name. |
EncryptionIV | The initialization vector to be used for encryption/decryption. |
EncryptionKey | The key to use during encryption/decryption. |
AcceptEncoding | Used to tell the server which types of content encodings the client supports. |
AllowHTTPCompression | This property enables HTTP compression for receiving data. |
AllowHTTPFallback | Whether HTTP/2 connections are permitted to fallback to HTTP/1.1. |
Append | Whether to append data to LocalFile. |
Authorization | The Authorization string to be sent to the server. |
BytesTransferred | Contains the number of bytes transferred in the response data. |
EncodeURL | If set to true the URL will be encoded by the cmdlet. |
FollowRedirects | Determines what happens when the server issues a redirect. |
GetOn302Redirect | If set to true the cmdlet will perform a GET on the new location. |
HTTPVersion | The version of HTTP used by the cmdlet. |
HTTP2HeadersWithoutIndexing | HTTP2 headers that should not update the dynamic header table with incremental indexing. |
IfModifiedSince | A date determining the maximum age of the desired document. |
KeepAlive | Determines whether the HTTP connection is closed after completion of the request. |
LogLevel | The level of detail that is logged. |
MaxRedirectAttempts | Limits the number of redirects that are followed in a request. |
NegotiatedHTTPVersion | The negotiated HTTP version. |
OtherHeaders | Other headers as determined by the user (optional). |
ProxyAuthorization | The authorization string to be sent to the proxy server. |
ProxyAuthScheme | The authorization scheme to be used for the proxy. |
ProxyPassword | A password if authentication is to be used for the proxy. |
ProxyPort | Port for the proxy server (default 80). |
ProxyServer | Name or IP address of a proxy server (optional). |
ProxyUser | A user name if authentication is to be used for the proxy. |
TransferredData | The contents of the last response from the server. |
TransferredDataLimit | The maximum number of incoming bytes to be stored by the cmdlet. |
TransferredHeaders | The full set of headers as received from the server. |
UseChunkedEncoding | Enables or Disables HTTP chunked encoding for transfers. |
ChunkSize | Specifies the chunk size in bytes when using chunked encoding. |
UserAgent | Information about the user agent (browser). |
KerberosSPN | The Service Principal Name for the Kerberos Domain Controller. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the cmdlet whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The port in the local host where the cmdlet binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
ProxyExceptionsList | A semicolon separated list of hosts and IPs to bypass when using a proxy. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
UseIPv6 | Whether to use IPv6. |
TcpNoDelay | Whether or not to delay when sending packets. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
UseBackgroundThread | Whether threads created by the cmdlet are background threads. |
UseInternalSecurityAPI | Tells the cmdlet whether or not to use the system security libraries or an internal implementation. |