Utility to Zip License & Reporting Data
Cloudhouse provide this sample utility to assist the license data submission process. The utility will zip up the license usage data and open up https://sendto.cloudhouse.com/filedrop/Licensing in a browser tab, and the directory containing the zip in Explorer.
Usage
.\SendLicenseData -partner partnername -customer customername -year yyyy -month mm
Example
.\SendLicenseData -partner acme -customer roadrunner -year 2017 -month 10
Script
<# .SYNOPSIS Cloudhouse utility to Zip up license usage data to submit for billing .DESCRIPTION Cloudhouse provide this sample utility to zip up the license usage data and submit it to Cloudhouse. .PARAMETER partner Please specify the name of the partner or SI submitting the data. For customers submitting their own data, please specify your name here too. .PARAMETER customer Please specify the name of the customer you are submitting the license data on behalf of. .PARAMETER year Please specify the year of the license data. .PARAMETER month Please specify the month of the license data. .EXAMPLE For ACME to submit Roadrunner's usage data for Oct 2017 .\SendLicenseData -partner acme -customer roadrunner -year 2017 -month 10 .LINK https://docs.cloudhouse.com/37619-licensing-reporting/266748 https://docs.cloudhouse.com/37619-licensing-reporting/266747-deployment-and-usage-event-reporting https://sendto.cloudhouse.com/filedrop/Licensing #> Param( [Parameter(Mandatory=$True)][String]$partner, [Parameter(Mandatory=$True)][String]$customer, [Parameter(Mandatory=$True)][String]$year, [String]$month ) $current_path = Get-Location $source = [System.IO.Path]::Combine($current_path, $year, $month) # Make sure the source directory exists, otherwise exit If( -Not (Test-Path $source)) { Write-Output (-join("Source folder doesn't exist: ", $source)) Write-Output "Exiting" exit } if ($month -eq "") { $month = "all" } # Delete the destination zip if it exists Write-Output $current_path $destination = -join($partner, "_", $customer, "_", $year, "_", $month, ".zip") $destination = Join-Path -Path $current_path -ChildPath $destination If(Test-path $destination) { Write-Output (-join("Destination zip already exists, deleting: ", $destination)) Remove-Item $destination } # create the zip archive Write-Output (-join("Creating the zip archive ", $destination)) Add-Type -assembly "system.io.compression.filesystem" try { [io.compression.zipfile]::CreateFromDirectory($source, $destination) Write-Output (-join("Created the archive ", $destination)) #Open up the browser tab with submission url Start-Process "https://sendto.cloudhouse.com/filedrop/Licensing" #Open up explorer with location of zip Start-Process "file://$current_path" } catch { Write-Output "`nFailed to create the archive", $PSItem }
Disclaimer
Sample scripts are not supported under any Cloudhouse standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Cloudhouse further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Cloudhouse, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Cloudhouse has been advised of the possibility of such damages.