Public/Read-Config.ps1

<#
    .SYNOPSIS
    Read the org configuration from the user

    .DESCRIPTION
    This will prompt the user for the salesforce/hsdp configuration required and return an object with that information.

    .INPUTS
    None. You cannot pipe objects to Read-Config.

    .OUTPUTS
    The new configuration object.

    .EXAMPLE
    PS> Read-Config
#>

function Read-Config {

    Write-Host "===== SFDC Username and Password"
    $SfCredentials = Get-Credential

    $SfSecurityToken = Read-Host -Prompt "SFDC Security Token"

    Write-Host "===== SFDC Oauth Consumer Key and Secret"
    $SfOauth = Get-Credential

    Write-Host "===== IAM Username and Password"
    $IamCredentials = Get-Credential

    $Sandbox = $false
    if ((Read-Host -Prompt "Sandbox? (Y/N)") -eq "Y") {
        $Sandbox = $true
    }

    Write-Output (New-Object PSObject -Property @{
        SfCredentials = $SfCredentials
        SfSecurityToken = $SfSecurityToken
        SfOauth = $SfOauth
        IamCredentials = $IamCredentials
        Sandbox = $Sandbox
        Scopes = @("profile","email","read_write")
    })
}