public/Disable-CloudServer.ps1
|
<#PSScriptInfo
.VERSION 1.0.0.0 .GUID a2a87f73-235b-4eee-8c2a-81eb3df2a1a5 .AUTHOR Mikail Aras - META10 .COMPANYNAME META10 .COPYRIGHT (C) 2025 by META10 - Alle Rechte vorbehalten .TAGS Script PowerSHELL Disable-CloudServer .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 |2025.02.18 |mike |Script erstellt. .PRIVATEDATA #> <# Requires -Module crm class library #> <# .DESCRIPTION Disable Cloud Server by setting statecode to 1 (inactive) #> function Disable-CloudServer { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Name ) $logal = [system.collections.arraylist]::new() # log arraylist if(Test-CCCRMConnection){ if($name){ $crmServer = [CloudServer]::New($name, 'active') if($crmServer.Name){ $crmServer.Disable() $null = $logal.add("Disabled crm server with following name $($name)") }else{ write-warning -message "Couldnt find crm server with following name $($name). If its a cloud server duplicate, run the static method [cloudserver]::disable(servername) to disable the server" $null = $logal.add("Couldnt find crm server with following name $($name). If its a cloud server duplicate, run the static method [cloudserver]::disable(servername) to disable the server") } # 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 |