public/Get-CloudCredential.ps1

<#PSScriptInfo
 
.VERSION 1.0.0.0
 
.GUID f13916a0-b458-4cc4-aedf-9f3aefd9bff1
 
.AUTHOR Mikail Aras - Meta10
 
.COMPANYNAME Meta10
 
.COPYRIGHT (C) 2024 by Meta10 - Alle Rechte vorbehalten
 
.TAGS Script PowerSHELL function_connect_exchangeonline_unattended
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
Aenderungsverlauf des Scripts nach dem Schema Major.Minor.Build.Revision,jeweils Major Versionen sind produktiv zu verwenden
Version |Type |Datum |Benutzer |Bemerkungen
1.0.0.0 |BUILD |2024.06.18 |mike |Script erstellt.
 
.PRIVATEDATA
 
#>


<# Requires -Module none #>

<#
 
.DESCRIPTION
get cloud credential
 
#>


function Get-CloudCredential {
    param(
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Name
    )

    #$logal = [system.collections.arraylist]::new() # log arraylist

    if(Test-CCCRMConnection){
        if($name){
            $cloudcredential = [cloudcredential]::New($name)

            if($cloudcredential.name){
                $cloudcredential

            } # end of if

            #$null = $logal.add("configured dns client server address for interface alias $($ethif) with server addresses $($args[2]) and $($args[3])")
        } # end of if computername

        $logal

        foreach($log in $output){
            #write-customlog -path $pathtolog -message $log -level 'info'

        } # end of foreach
    }
} # end of function

<#
if ($Customer -ne "none") {
    #CEC-BlockState "Block"
    #$cred = CEC-GetCRMCred
    [pscredential]$cred = New-Object System.Management.Automation.PSCredential("meta10\62508.crm-api", (ConvertTo-SecureString "Lr4+4A%CeMBfYd3p" -AsPlainText -Force))
    Connect-CCCRM -Credential $cred
    $CloudCustomer = [CloudCustomer]::New($Customer)
    $CloudCustomer.CloudServers() #| Out-Null
    $CloudCustomer.CloudAccounts() #| Out-Null
    $CloudCustomer
    Export-Clixml -InputObject $CloudCustomer -Path "$Rootpath\CloudCustomer.xml"
    Write-Log -Level INFO -Message "[$((Get-Item $PSCommandPath).Name)] [$($MyInvocation.MyCommand.Name)] XML Export erfolgreich: $Rootpath\CloudCustomer.xml"
    Disconnect-CCCRM
    $cred = $null
    Write-Output "Success, check Automation Log on ScriptSys for Details"
    Write-Log -Level INFO -Message "[$((Get-Item $PSCommandPath).Name)] [$($MyInvocation.MyCommand.Name)] Script End"
    Wait-Logging
    CEC-BlockState "Unblock"
    "End: "+(Get-Date).DateTime
} else {
    Write-Output "Access Denied, invalid Token or Customer"
    "End: "+(Get-Date).DateTime
}
#>