Remove-CloudStorage Cmdlet
Parameters Output Objects Configuration Settings
The Remove-CloudStorage component is used to delete files and directories from Cloud Storage providers.
Syntax
Remove-CloudStorage [parameters]
Remarks
The RemoteFile parameter determines which file to remove from the remote host. Wildcards (*) can be used to remove multiple files, and empty directories can also be deleted.
The following providers use OAuth 2.0 for authentication:
- Box.com
- DropBox
- Google Drive
- Google Cloud Storage*
- Microsoft 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.
To authenticate with the remaining providers, use the parameters shown in the table below:
Provider | Relevant Parameters |
Amazon S3 | AccessKey and SecretKey |
Azure Blob | Account and AccessKey |
Azure File | Account and AccessKey |
Digital Ocean Spaces | AccessKey and SecretKey |
Google Cloud Storage* | ProjectId (if using OAuthClientId and OAuthClientSecret for OAuth); or, AccessKey and SecretKey |
Hadoop DFS | Multiple HTTP authentication schemes are supported; refer to AuthMechanism for more information. HadoopURL must always be set. |
Wasabi | AccessKey and SecretKey |
*Google Cloud Storage supports two authentication methods. To authenticate with OAuth 2.0 (preferred) set the OAuthClientId, OAuthClientSecret, and ProjectId parameters. To authenticate with an access and secret key, set the AccessKey and SecretKey parameters instead.
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.
#remove a single file from Amazon S3 Remove-CloudStorage -ServiceProvider Amazons3 -AccessKey $accesskey -SecretKey $secretkey -RemoteFile "test/delete_me.txt" #remove all text files from a subfolder in Box Remove-CloudStorage -ServiceProvider Box -OAuthClientId $boxid -OAuthClientSecret $boxsecret -RemoteFile "test/*.txt" #remove a Wasabi directory/bucket (must be empty to suceed) Remove-CloudStorage -ServiceProvider Wasabi -AccessKey $accesskey -SecretKey $secretkey -RemoteFile "myBucket"
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. |
AccessKey | A storage service provider access key. |
Account | A storage service provider account string. |
AuthMechanism | The HTTP authentication scheme to use (for storage service providers that support multiple). |
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. |
HadoopURL | The URL of the Hadoop WebHDFS server. |
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. |
Password | A storage service provider password. |
ProjectId | A Google Cloud Platform project Id string. |
RemoteFile | The name of the remote file to delete. |
RemotePath | The path on the server. |
SecretKey | A storage service provider access key. |
ServiceProvider | The storage service provider. |
Timeout | The maximum time allowed for the operation. |
User | A storage service provider user name. |
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.
AWSProfile | The name of the AWS CLI profile that the component should use to obtain authentication and region information. |
AWSProfileDir | The location of the AWS CLI credentials and config files. |
ContentDisposition | The Content-Disposition to send when uploading an file to an S3-like storage provider. |
ContentType | The Content-Type to send when uploading an file to an S3-like storage provider. |
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. |
EncryptionIV | The initialization vector to be used for encryption/decryption. |
EncryptionKey | The key to use during encryption/decryption. |
FragmentSize | The fragment size that the component should use when uploading files in multiple fragments. |
ListResourcesScope | Controls the scope of the results when listing GoogleDrive resources. |
NewVersionOnOverwrite | Whether to upload new file versions instead of performing true overwrites. |
NormalizedFileName[i] | The normalized file name. |
Region | For applicable providers, specifies the region to use. |
SharedDriveId | The Id of the Google Drive shared drive to list resources for. |
SheetsExportFormat | The file format to export Google Sheets files as when downloading. |
SimpleUploadLimit | The threshold above which the component will choose to perform a multipart upload, for applicable storage service providers. |
SlidesExportFormat | The file format to export Google Slides files as when downloading. |
UseVirtualHosting | Determines which URL style S3-like storage service providers should use. |
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. |
ChunkSize | Specifies the chunk size in bytes when using chunked encoding. |
CompressHTTPRequest | Set to true to compress the body of a PUT or POST request. |
EncodeURL | If set to true the URL will be encoded by the component. |
FollowRedirects | Determines what happens when the server issues a redirect. |
GetOn302Redirect | If set to true the component will perform a GET on the new location. |
HTTP2HeadersWithoutIndexing | HTTP2 headers that should not update the dynamic header table with incremental indexing. |
HTTPVersion | The version of HTTP used by the component. |
IfModifiedSince | A date determining the maximum age of the desired document. |
KeepAlive | Determines whether the HTTP connection is closed after completion of the request. |
KerberosSPN | The Service Principal Name for the Kerberos Domain Controller. |
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. |
SentHeaders | The full set of headers as sent by the client. |
StatusLine | The first line of the last response from the server. |
TransferredData | The contents of the last response from the server. |
TransferredDataLimit | The maximum number of incoming bytes to be stored by the component. |
TransferredHeaders | The full set of headers as received from the server. |
TransferredRequest | The full request as sent by the client. |
UseChunkedEncoding | Enables or Disables HTTP chunked encoding for transfers. |
UseIDNs | Whether to encode hostnames to internationalized domain names. |
UserAgent | Information about the user agent (browser). |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the component 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. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
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 component 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. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseIPv6 | Whether to use IPv6. |
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. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
UseInternalSecurityAPI | Tells the component whether or not to use the system security libraries or an internal implementation. |