Initialer Import der Synology Scripts
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
. "C:\\Shutdown\\Config.ps1"
|
||||
|
||||
Import-Module ".\\Modules\\Logging.psm1"
|
||||
Import-Module ".\\Modules\\Retry.psm1"
|
||||
Import-Module ".\\Modules\\Credentials.psm1"
|
||||
Import-Module ".\\Modules\\VCenter.psm1"
|
||||
Import-Module ".\\Modules\\Shutdown.psm1"
|
||||
|
||||
Start-Transcript -Path (Join-Path $Config.LogPath "shutdown.log")
|
||||
|
||||
Write-Log "Shutdown started"
|
||||
|
||||
$vCenterCred = Get-CredentialFromFile $Config.CredFiles.vCenter
|
||||
|
||||
Connect-ToVCenter -Server $Config.VCenterServer -Credential $vCenterCred
|
||||
|
||||
$VMGroups = Import-Csv $Config.CSVGroups -Delimiter ";"
|
||||
$VMGroups | ForEach-Object { $*.Gruppe = [int]$*.Gruppe }
|
||||
|
||||
Stop-UnknownVMs -VMGroups $VMGroups -ExcludeRegex "vCLS|vSAN"
|
||||
Stop-VMsByGroup -VMGroups $VMGroups
|
||||
|
||||
Stop-ClusterSafe -Cluster $Config.Cluster -Reason "Automated shutdown"
|
||||
|
||||
Write-Log "Shutdown completed"
|
||||
|
||||
Stop-Transcript
|
||||
Reference in New Issue
Block a user