I am experiencing issues with the wg-easy VPN service, as the VPS containers seem to go down frequently. I have set up a cron job to reboot every 2 hours, but it doesn't seem to help much.
I am also interested in setting up an auto reboot using a Powershell script on Automation Accounts, but I am not sure if my runbook script is correct. Here is the script I have written:
$resourceGroupName = "xxx-resource-group"
$vmNames = @(
"xxx-virtual-machine",
"xxx_virtual_machine",
"xxx-virtual-machine"
)
$trigger = New-JobTrigger -Once -At (Get-Date).AddMinutes(2) -RepetitionInterval (New-TimeSpan -Hours 2) -RepetitionDuration ([TimeSpan]::MaxValue)
Register-ScheduledJob -ScriptBlock {
Connect-AzAccount -Identity
foreach ($vmName in $vmNames) {
Restart-AzVM -ResourceGroupName $resourceGroupName -Name $vmName
}
} -Trigger $trigger
I would appreciate any help with troubleshooting the wg-easy VPN service issues and with verifying if my Powershell script is correct.
Thank you.

