PowerShell Example
Modified on: Tue, Mar 23, 2021 at 3:39 PM
This sample PowerShell script is an all in one script that will download all the subscription updates for all of your company subscriptions onto your machine. The following parameters will need to be set for it to work for you.
You need to specify your API_TOKEN in order to gain permission to your subscriptions
$global:api_token = "API_TOKEN" # Update to match API Token from Altalis $global:temp_path = $env:Temp # Update to download the files to a different location
By default the script will try and get updates for one month prior to the date the script is run. If you would like to customize that date simply provide the date in a date string like below. Selecting a date of 1900-01-01 will get the full data with all changes.
GetUpdates '2017-01-01'
If you would like to get all updates, use the date 1900-01-01. To use this PowerShell script you may need to enable your computer to run PowerShell scripts.
Troubleshooting
- altalis_subscription_data.ps1 is not digitally signed
If you run into this error when trying to run the script, it is because the script is not digitally signed. This is a default security measure by Windows.- Option 1: Get the script digitally signed
- You can read more about it here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_signing?view=powershell-6
- Option 2: Change the execution policy by running the following
- Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
- Option 1: Get the script digitally signed
- Requires TLS 1.2
Our servers require communications use TLS 1.2. By default on many machines they are set to use TLS 1.1. You can force TLS 1.2 in PowerShell with the following line at the top of your script- [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
- If you are using Windows Server 2012, Windows 7 Service Pack 1 (SP1), and Windows Server 2008 R2 SP1 you will need to enable TLS 1.2. Read more about that here https://support.microsoft.com/en-ca/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-a-default-secure-protocols-in
Special thanks to those who helped developing this example:
- Darcy Dechene of Silvacom Ltd.
- Andrew Porohowski of FortisAlberta