public/New-CloudAccount.ps1
|
<#PSScriptInfo
.VERSION 1.0.0.0 .GUID 9c7034c4-4541-42a3-974e-952d6ec222cc .AUTHOR Mikail Aras - Meta10 .COMPANYNAME Meta10 .COPYRIGHT (C) 2024 by Meta10 - Alle Rechte vorbehalten .TAGS Script PowerSHELL New-CloudAccount .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.03.04 |mike |Script erstellt. .PRIVATEDATA #> <# Requires -Module get-hypervisor #> <# .DESCRIPTION new crm cloud account #> function New-CloudAccount { param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Name, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [ValidateSet('Named User', 'Shared User', 'Hosted Exchange User', 'Scanner / FTP', 'Test User')] [string]$Type, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$CustomerName, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$FirstName, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$LastName, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Password, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [datetime]$Datetime ) $logal = [system.collections.arraylist]::new() # log arraylist if(Test-CCCRMConnection){ if($name){ $cloudcustomer = [cloudcustomer]::New($customername) [byte]$typetemp01 = 1 switch ($type) { "Named User" { $typetemp = 1 } "Shared User" { $typetemp = 2 } "Hosted Exchange User" { $typetemp = 3 } "Scanner / FTP" { $typetemp = 4 } "Test User" { $typetemp = 5 } "ASP User" { $typetemp = 6 } "Hosted SharePoint User" { $typetemp = 10 } } # end of switch if(!([string]::IsNullOrEmpty($cloudcustomer.name))){ $error.clear() $cloudaccount = [cloudaccount]::new() try{ $cloudaccount.newcloudaccount($firstname, $lastname, $name, $datetime, $password, $typetemp01, $cloudcustomer.customerid) }catch{ write-error -message "couldnt create cloud account $($name) due to following error $($error[-1].exception)" } # end of try catch block }else{ write-error -message "cloudcustomer $($cloudcustomer) is empty" } # end of if primary server #$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 |