# Request-APIKey.PS1
# Binary Tree Inc
# Sept 2019
# Disclaimer: This example script is shared freely without warranty or support. It is only intended to provide guidance by example to project administrators.
# This example code can be added to a script to prompt the end-user to enter their authorized API key before running the desired commands.
# This example code will also verify the Binary Tree module is installed and if not it will be installed.
# Connect to production instance of Power365 by asking for their API Key
Write-Host
write-host 'To connect to Power365, enter the API key supplied to you to your Binary Tree representative: '
$apikey = Read-Host
# Verify Module is installed, if not install it then exit script, otherwise connect to Power365.
$VerifyInstall = Get-InstalledModule -Name BinaryTree.Power365 -ErrorAction silentlycontinue
If(!$VerifyInstall){
Write-host "Binary Tree Module was not found. It will be installed now. Please restart this script after installation."
Install-Module BinaryTree.Power365 -Confirm:$False -Force
Exit
}
Else
{
Connect-BTSession -ApiKey (ConvertTo-SecureString $apikey -AsPlainText -Force)
}
# Add your script below
© ALL RIGHTS RESERVED. Feedback 使用条款 隐私 Cookie Preference Center