public/Set-CloudCustomer.ps1

<#PSScriptInfo
 
.VERSION 1.0.0.0
 
.GUID d9455621-6d60-48f1-9b28-3ce6878a0516
 
.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.05.23 |mike |Script erstellt.
 
.PRIVATEDATA
 
#>


<# Requires -Module get-hypervisor #>

<#
 
.DESCRIPTION
set crm cloud customer properties with powershell class library
 
#>


function Set-CloudCustomer {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Name,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Domain
    )

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

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

            if($cloudcustomer.name){
                if($domain){
                    $error.clear()

                    try{
                        $cloudcustomer.setcustomerdomain($domain)
                        write-host "set customerdomain $($domain) for following customer $($name)" -foregroundcolor 'yellow'

                    }catch{
                        write-error -message "couldnt set customerdomain $($domain) for following customer $($name) due to following error $($error[-1].exception)"

                    } # end of try catch block
                } # end of if password
            }else{
                write-warning -message "couldnt find crm server with following name $($computername)"

            } # end of if crmserver name

            #$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