# Import necessary modules Import-Module Corsinvest.ProxmoxVE.Api Import-Module ImportExcel # Proxmox connection info $ProxmoxURL = "https://your-proxmox-url:8006" $ProxmoxUser = "root" $ProxmoxPassword = "P@ssw0rd" $ProxmoxRealm = "pam" # Connect to Proxmox $credentials = New-Object System.Management.Automation.PSCredential ($ProxmoxUser, (ConvertTo-SecureString $ProxmoxPassword -AsPlainText -Force)) $null = Connect-PveCluster -Server $ProxmoxURL -User $ProxmoxUser -Realm $ProxmoxRealm -Credential $credentials # Read Excel data $excelPath = "/path/to/depl_systems.xlsx" $hostsData = Import-Excel -Path $excelPath # Function to get VMs from Proxmox function Get-ProxmoxVMs { $vms = Get-PveVM return $vms } # Function to check missing VMs function Get-MissingVMs { $proxmoxVMs = Get-ProxmoxVMs $missingVMs = @() foreach ($host in $hostsData) { $vmName = $host.'VM-Name' if ($proxmoxVMs | Where-Object { $_.name -eq $vmName } -eq $null) { $missingVMs += $host } } return $missingVMs } # Function to get node usage function Get-NodeUsage { param ($node) $usage = Get-PveNodeStatus -NodeName $node return @{ Node = $node MaxMem = $usage.memory.total Mem = $usage.memory.used MaxDisk = $usage.rootfs.total