Initialer Import der Synology Scripts
This commit is contained in:
Executable
+63
@@ -0,0 +1,63 @@
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
[xml]$xaml = @"
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Proxmox Manager" Height="350" Width="525">
|
||||
<Grid>
|
||||
<Button Name="CheckHostsButton" Content="Check Hosts" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="50" Margin="10"/>
|
||||
<Button Name="ListServersButton" Content="List Servers" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="50" Margin="120,10,0,0"/>
|
||||
<Button Name="CreateVMButton" Content="Create VM" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="50" Margin="230,10,0,0"/>
|
||||
<TextBox Name="OutputTextBox" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,70,0,0" Height="200" Width="480"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
"@
|
||||
|
||||
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
$Window = [Windows.Markup.XamlReader]::Load($reader)
|
||||
|
||||
$CheckHostsButton = $Window.FindName("CheckHostsButton")
|
||||
$ListServersButton = $Window.FindName("ListServersButton")
|
||||
$CreateVMButton = $Window.FindName("CreateVMButton")
|
||||
$OutputTextBox = $Window.FindName("OutputTextBox")
|
||||
|
||||
# Verbindung zu Proxmox
|
||||
$ProxmoxServer = "https://proxmox.example.com:8006/api2/json"
|
||||
$ProxmoxUser = "root@pam"
|
||||
$ProxmoxPassword = "yourpassword"
|
||||
$ProxmoxRealm = "pam"
|
||||
|
||||
$null = Connect-PVEModule -Server $ProxmoxServer -User $ProxmoxUser -Password $ProxmoxPassword -Realm $ProxmoxRealm
|
||||
|
||||
# Event Handler für CheckHostsButton
|
||||
$CheckHostsButton.Add_Click({
|
||||
$OutputTextBox.AppendText("Checking Hosts..." + [Environment]::NewLine)
|
||||
# Hier können Sie den Status Ihrer Proxmox Hosts überprüfen
|
||||
})
|
||||
|
||||
# Event Handler für ListServersButton
|
||||
$ListServersButton.Add_Click({
|
||||
$OutputTextBox.AppendText("Listing Servers..." + [Environment]::NewLine)
|
||||
# Hier können Sie die Liste der Server anzeigen
|
||||
})
|
||||
|
||||
# Event Handler für CreateVMButton
|
||||
$CreateVMButton.Add_Click({
|
||||
$OutputTextBox.AppendText("Creating VM from Excel data..." + [Environment]::NewLine)
|
||||
|
||||
# Excel-Datei lesen
|
||||
$excelPath = "C:\path\to\your\vm_data.xlsx"
|
||||
$vmData = Import-Excel -Path $excelPath
|
||||
|
||||
foreach ($vm in $vmData) {
|
||||
$name = $vm.Name
|
||||
$memory = $vm.Memory
|
||||
$cpu = $vm.CPU
|
||||
|
||||
$OutputTextBox.AppendText("Creating VM: $name" + [Environment]::NewLine)
|
||||
|
||||
New-PVEVM -Node 'pve' -VMID 100 -Name $name -Memory $memory -Sockets $cpu
|
||||
}
|
||||
})
|
||||
|
||||
$Window.ShowDialog() | Out-Null
|
||||
Reference in New Issue
Block a user