Start-vm-on-connect logging

It would be nice that Nerdio has it's own start vm on connect or has a way to integrate into the start-vm-on-connect of azure. This way, we ensure that the scripted actions we associated to the host-pool are being run on all sessionhosts that are being started. Now, the scripts only work if nerdio is the initiator of the VM-start.

We now run into an issue, that when a script is started by start-vm-on-connect, that the scripts aren't run that we defined in nerdio.

2

Comments (7 comments)

Avatar
DStephenson
(Edited )

Welcome to the community, Alwin Dijkstra 🙂!

There's another thread (Workaround For Adding FSLogix Storage Key To Credential Manager With Start On Connect - Bad Idea?) where someone had a similar question about the Start VM on Connect Feature and I added some thoughts.
I know when I talked to the Nerdio Team about it in the past, they mentioned they are limited in what they can do because, currently, Microsoft doesn't allow other tasks/commands to be injected during the "Start on Connect" action.  Because of that limitation, you're "stuck" deciding if you're going to get more savings from utilizing "Start on Connect" and missing-out on the Nerdio features or using Nerdio to keep a machine running 24x7/using scheduled starts/stops.

I'm guessing that's not the answer you were looking for, but hopefully it helps with the current "start on connect" issue(s) you're running into. 🤞

1
Avatar
Jan Scholte

Hi Alwin Dijkstra

For easy deployment you can also use this template script to deploy a startup scheduled task with script content in one action. You can find the template here in the Sales Engineers Github: NMM-SE/Scripted Actions/Template-Create-Trigger_StartUp_ScheduledTask.ps1 at main · Get-Nerdio/NMM-SE (github.com)
Keep in mind these are no official solutions provided by Nerdio please refer to the disclaimer on the repo: Get-Nerdio/NMM-SE (github.com)

1
Avatar
Alwin Dijkstra

Hi DStephenson & Jan Scholte

As you guys both suggested, I will try the scheduled task method on the Desktop image that will trigger the azure runbook automation to start the application servers.The script thath @Jan Scholte provided is really helpfull. This script allows me to just run the script via Nerdio on the desktop-image without having to login and make the scheduled-task manually and upload the azurerunbook trigger script.

I will let you guys know if this is the solution we are looking for!

1
Avatar
Jan Scholte
(Edited )

DStephenson and Alwin Dijkstra I also wrote a specific version for the FSLogix Storage key add to Credential Manager: NMM-SE/Scripted Actions/New-SchTask_Add_AzFilesKey_FSLogix.ps1 at main · Get-Nerdio/NMM-SE (github.com)

1
Avatar
DStephenson

Very cool, Jan Scholte!
Thanks for sharing those scripts. 🙂

0
Avatar
Alwin Dijkstra

Hi Jan Scholte & DStephenson ,I managed to get it to work!Now Application-servers are being started when the first session host is being started. Even with start-on-connect!!Also, when the last session host is being turned off, the app-servers are also shutting down. This is controlled by Nerdio itself. (Run scripts when VM shuts down in host-pool properties)

The script of Jan helped me to deploy the scheduled task quickly to all the hosts and image.

kind regards,

Alwin

2
Avatar
Alwin Dijkstra

Here to bring this idea back on the table.
This problem can be solved by logging a VM / host is started in Nerdio when the vm is started with vm on connect. Additional logging querys needed to be added to the law of NMM. When a vm is started by start-vm-on-connect, the event in audit-log is initiated by Windows Virtual Desktop. (Check screenshot)
Query example:

AzureActivity
| where OperationNameValue == "Start virtual machine"
| where ResourceProviderValue == "Microsoft.Compute"
| where ActivityStatusValue == "Succeeded"
| where Caller == "Windows Virtual Desktop"
| project TimeGenerated, ResourceGroup, Resource, Caller, OperationNameValue, ActivityStatusValue
2

Please sign in to leave a comment.