Speaker 1: Nerdio Manager will run a PowerShell script for you at exactly the right moment. A scripted action is a script attached to a step Nerdio Manager already performs, either inside a Windows virtual machine or out in Azure. You don't have to write it yourself because Nerdio Manager ships with a library of scripts you can attach and reuse. The timing is what matters since the same script can fire when a host is created, when an image is built, or on a schedule you set. That is how a step you'd normally do by hand on every host starts happening the same way, every time, whether or not anyone remembers it. Let's start with the simplest version, because the name makes this sound heavier than it is. A scripted action is a PowerShell script that Nerdio Manager runs for you as part of a task it was already doing. That is the whole idea, and everything else here builds on it. The word doing the work is action. You aren't storing a script in a folder and hoping someone remembers to run it. You attach that script to a step in the life of a host or an image, so Nerdio Manager runs it at the moment you picked on its own. A scripted action has two possible homes, and getting this straight early saves a lot of confusion later. A Windows script runs inside the virtual machine on the Windows guest itself. An Azure runbook runs out in Azure through an automation account, which puts it outside the VM. Same feature, same intent, two different homes. So what does that buy you on a normal day? If you've ever built an AVD host pool, you know the pattern. There's a short list of things that have to happen on every host every time, and that list is easy to drop when you're moving fast. A scripted action turns those into a repeatable step rather than a habit that lives in one admin's head. A couple of things to note before we go deeper. Scripted actions run PowerShell, so if you plan to write your own, some comfort with that helps a lot. If you don't have that yet, the library that ships with Nerdio Manager still gets you a long way, and there's more on it later. When you go looking for the feature, you'll find it under Endpoints, then Automation, then Scripted Actions. That's also where you'll see the two tabs, one for Windows scripts and one for Azure Runbooks. There's an honest limit worth saying plainly. A scripted action doesn't understand your environment. It's a script with a trigger, and if the script is wrong or the trigger fires at the wrong time, the result is wrong too. It's wrong on every host it touches, which is exactly why the timing deserves its own section. Now that we know what a scripted action is, the first real decision is where it runs because that choice changes what the script can do. A Windows script runs directly on the virtual machine. Nerdio Manager uses the Azure custom script extension to push PowerShell code onto the host. and from there it runs machine-wide as part of provisioning. Think of them a little like sign-in scripts, except they don't wait for a user to sign in. They run on the machine itself, and they run with administrative rights, and Azure Runbook takes the other path. It runs in an automation account in Azure outside the VM, which is what you want when the job is really about Azure, creating a resource, tagging something, adjusting a network setting. That kind of work belongs in Azure, not inside a guest. Nerdio's own documentation is direct about this split. Running Azure-targeted work on a session host is less efficient and can be unreliable, so for that kind of task, you use an Azure runbook. Some scripts even need the VM to be restarted or shut down, and the script running inside that VM can't very well restart itself and then carry on. There's a detail here that surprises people the first time. With an Azure runbook, you don't pass credentials at all. By the time your code runs, Nerdio Manager is already signed into Azure. so that plumbing is handled for you. What you do need is for the Nerdio Manager Service Principle to hold the right permissions on whatever the script touches, and we'll come back to that in the security section. So how do you choose if the work happens inside Windows? Like a registry change or an app install, it's a Windows script. If the work happens in Azure or it needs the machine off or restarting, it's a runbook. A couple of things to note though, because one of these choices has a trap attached and it catches people more often than you'd think. The trigger is where the value lives, so let's walk through the moments a scripted action can fire. The main one is the VM lifecycle. Nerdio Manager can run a scripted action during provisioning, during a re-image, and when a host is stopped or started. Whenever a session host is created, destroyed, stopped or started, the scripted action runs as a final step of that task. On creation, there's a detail most people miss the first time. and it's worth slowing down for. You get two separate slots. The first runs right after the VM is built and joined to the domain, but before the AVD agent is registered. The second slot runs after the VM has joined the host pool, but before the host is available to users. Those are different states, and a script that needs the AVD agent present will fail in the first slot. Choosing the right slot is one of those small decisions that decides whether your deployment just works. Then there's the manual option called Run Script. This is how you push a scripted action across a host pool on demand, which is useful when you want to change something on every host without re-imaging them all. A registry change is the classic example. When you've started that way, you get a set of controls worth knowing about. You can have Nerdio Manager restart the hosts afterward, process them in groups rather than all at once, and stop the run after a set number of failures. You can also send a message to active users and wait before starting, which matters when people are signed in and you'd rather not pull the flaw out from under them. You can also choose to pass Active Directory credentials to a script. Because some automation needs to talk to your directory, that's an option you switch on for a particular action rather than something you bake into the code. Schedules are the other big one. You can switch a schedule on so a scripted action runs on a recurring basis and you can manage those scheduled actions later. Editing a schedule, changing the parameters, or running one manually when you need it right now. One more thing, because it's easy to overlook, scripted actions aren't only for host pools, they apply to desktop images and to servers as well. So the same idea follows your image build and your server objects. Now that you know when a scripted action can run, the next question is what people actually use it for. Let's make this concrete. Because the abstract version only goes so far, the most common use is installing and uninstalling agents. Nerdio Manager ships with scripts for a long list of them, including Huntress, Kaseya VSA, ConnectWise Automate, Ninja RMM, Sentinel-1, Dato RMM, Threadlocker, CrowdStrike, and Blackpoint. Instead of signing into each host and running an installer by hand, you attach the script and it happens during the build. Those scripts need secrets, and this is where the design gets sensible. An installer usually wants an API token, a site key, or an organization ID. Rather than pasting that into a script as key text, you store it as a secure variable and reference it from the script. We'll come back to secure variables in the security section, but it's worth knowing now that the agent scripts are built to use them. Then there are the small unglamorous jobs that save the most time. Changing a registry key across every session host is a perfect fit Installing a certificate on a VM is another, and Nerdio Manager documents a scripted action for exactly that. None of these will impress anyone at a conference. They are the kind of task you'd otherwise do by hand on every host, in the right order, and hope you didn't miss one. For AVD specifically, there's an example that's easy to overlook. Nerdio Manager includes a scripted action to shrink FSLogix VHD and VHDX containers which helps with profile storage that keeps growing. That's a maintenance task that would be painful to do manually across a whole host pool. There's a useful way to think about the whole feature. If Nerdio Manager doesn't do something out of the box, a scripted action is often how you add it. BGinfo is a good example. Nerdio Manager doesn't install the BGinfo extension as part of its normal automation, but you can install it yourself with a scripted action, that's the pattern. The platform handles the lifecycle, and scripted actions fill the gaps, so the range runs from security agents to registry tweaks to maintenance jobs, and that's before anyone writes anything custom. The next question is where all these scripts come from and whether you have to build them yourself. The short answer is that you start from a library, not a blank page. Nerdio Manager ships with default scripts, so a lot of common jobs are already written for you. When you're new to the feature, that's the safest place to begin because those scripts are there, documented and readable before you run them. When you do bring your own, the experience is friendlier than you might expect. A Windows script can define parameters, and Nerdio Manager turns those into real controls in the interface. A true or false setting becomes a checkbox, a number becomes a number box with sensible bounds, and a list of options becomes a dropdown or a multiselect. The person running the script gets a form to fill in, not a command line to get right. You also don't have to hand your script every value it needs. Nerdio Manager passes a set of useful details in automatically, things like the host pool name, the subscription, the region, and the VM name. Your script can simply use them, and the documentation lists all of those built-in values if you want to see what's available. Now, the piece that surprises people is groups. Script actions groups let you bundle several scripts into one collection and attach that collection to a deployment task. Inside the group, the scripts run in the order you set, and you can drag them to reorder. That's handy when one step has to finish before the next one starts. A couple of things to note about groups. A group isn't a special mode because it runs exactly as if you had added those scripts one at a time, which means if the order is wrong, the outcome is wrong, the documentation is clear that you need to sequence both the individual scripts and the groups themselves in the order the task needs. One more convenience before we move on. You can clone a scripted action so when something is close but not quite right, you start from the working version instead of from nothing. That saves a surprising amount of fiddling. Two smaller things worth knowing. Script repositories can be refreshed, which is how you pick up newly released scripts without hunting them down. And if you'd rather not script at all, scripted sequences gives you a visual way to build a sequence of tasks on managed devices. Same spirit, less code. Now let's talk about the part that deserves real attention, because these scripts run with real reach. Start with secrets. Nerdio Manager has global secure variables, and they are stored in Azure Key Vault rather than sitting in plain text. Inside a script, you reference them with a simple naming pattern so the secret stays out of the code. That's the right default for an API token or a password, and it's why the agent installer scripts are built around secure variables. There's a useful refinement on top of that. You can scope a secure variable so it's passed only to the specific scripted actions you choose instead of being handed to everything. If a token is meant for one script, you can keep it that way, which limits the damage if something goes wrong later. The second thing to hold onto is privilege. Windows scripts run with administrative privileges. That isn't a surprise, and it doesn't interrupt other user sessions, which is why most scripts are safe to run while users are signed in. But administrative is administrative, so a scripted action deserves the same review. You'd give any change that runs as an admin across a whole host pool. If you want a stronger control, there's script signing. You can enable script signing with a certificate on a host pool on a desktop image. And for Intune scripts, so only signed scripts are trusted, That's the difference between anyone who can reach the console running anything and only scripts you sign being allowed to run. For Azure Runbooks, the permission model is worth understanding because it works differently. You don't pass credentials since Nerdio Manager is already authenticated to Azure. What matters instead is the service principle. It needs the right permissions on the resources your script touches and nothing beyond that. If a Runbook keeps failing on permissions, that's usually where to look first. There's a piece of housekeeping that comes with Azure Runbooks too. Nerdio Manager manages the automation certificate those Runbooks rely on, and it lets you renew that certificate and manage the module versions a Runbook uses. It isn't exciting, but a Runbook that stops working is often one of those two things. One last safety net, small but useful. Windows scripts get basic PowerShell syntax validation when you save them, so an obvious typo gets caught before you run anything. Just remember what that is, it's a syntax check, not a security review, and it won't tell you whether the script does the right thing. Everything so far has been how it works. Now, let's cover the handful of things that catch people the first time, because knowing them in advance saves a bad afternoon. The first one is reboots, and it's the most common. If your script restarts the machine, the whole process fails. The custom script extension is sitting there waiting for the script to finish, and when the machine reboots, the script never reports back. The documented fix is clean. Split the script into separate scripts, use the individual with restart execution mode, and order the remaining steps after it. There's also a built-in option to restart the VMs after the scripted action, and Nerdio's guidance is to use that instead of a PowerShell restart command for exactly the same reason. The second mistake is forgetting the clock. Custom script extensions have a 90-minute timeout set by Azure If the script hangs, waits for input that never arrives, or simply runs too long, it fails at that mark. So if a script is doing something slow, that ceiling is real, and it's better to know it before a deployment stalls halfway through. The third one is testing in the wrong place. The recommendation is to use an isolated development session host and run the script directly on it first. That gives you faster results than running everything through Nerdio Manager, and it keeps a mistake away from your production hosts. Then there's the Azure side trap. It's tempting to install the Azure PowerShell module on a session host and do Azure work from inside the VM. Nerdio's documentation is honest about that shortcut. It's less efficient, and it can be unreliable, so the better path is an Azure runbook. As we said earlier, some jobs have to shut the VM down or restart it, and a script inside the VM can't do that at all. That's the trap we hinted at, and it's best avoided from the start. It's also worth testing a scripted action across the scenarios you actually use, not just one. Nerdio's documentation recommends checking it when you run it on hosts, when you run it in bulk, and when you power off and set a host as an image. It also suggests checking the desktop image path, both creating an image from a library and creating one from an existing VM. A script that passes in one of those paths can still fail in another. Logging is the next one, and it's easy to skip. use write output as your script runs. For an Azure runbook, that output shows up in the task details in Nerdio Manager. For a Windows script, it goes to the VM logs instead, and you retrieve it by requesting the custom PowerShell script logs. One thing to remember is that write verbose output doesn't appear, so don't lean on it to tell you what happened. The last mistake is assuming a script works everywhere. Custom scripts aren't supported on cloud PCs, And custom scripts aren't supported inside Windows scripted actions groups. Those are documented limits rather than bugs, and they're the kind of thing you want to know before you design around them. So let's pull it back to one idea, because the details can crowd it out. A scripted action is a script with a trigger, and the trigger is what turns a task you have to remember into a task that simply happens. The scripts matter and the security matters, but the trigger is what makes the whole feature worth learning. One question is worth sitting with for a second, Which manual step do you repeat on every host in your environment and could it become a scripted action? That's usually the fastest place to begin because you already know the step works and you already know what it's supposed to do. If this made the topic feel less intimidating, subscribe to M365FM to master the tools and the mindset shaping the future of work.