Comments on: Schedule and Run PowerShell Scripts for Azure VMs using Azure Automation https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/ Cloud and Datacenter Blog focusing on Microsoft Azure Fri, 30 Jun 2023 20:32:15 +0000 hourly 1 https://wordpress.org/?v=6.4.1 By: Nick P https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-892866 Fri, 30 Jun 2023 20:32:15 +0000 https://www.thomasmaurer.ch/?p=24068#comment-892866 I am also getting error A parameter cannot be found that matches parameter name ‘ScriptString’.

Tried with PS 5.1 & 7.1

]]>
By: Dennis https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-890976 Sat, 18 Mar 2023 18:08:00 +0000 https://www.thomasmaurer.ch/?p=24068#comment-890976 Very powerful also in a hybrid environment with the hybrid worker.
You can run, manage, schedule the same scripts but also for on-prem VMs.

]]>
By: Jared Rachwalski https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-890942 Wed, 15 Mar 2023 17:47:07 +0000 https://www.thomasmaurer.ch/?p=24068#comment-890942 I too am getting the error:

Invoke-AzVMRunCommand : A parameter cannot be found that matches parameter name ‘ScriptString’.

I am running the command in a Powershell (v7.1) runbook through my Azure Automation account.

]]>
By: Thomas Maurer https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-885723 Thu, 24 Nov 2022 09:51:37 +0000 https://www.thomasmaurer.ch/?p=24068#comment-885723 In reply to Juliana.

Where do you run the command?

]]>
By: Juliana https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-884690 Wed, 09 Nov 2022 21:28:46 +0000 https://www.thomasmaurer.ch/?p=24068#comment-884690 Hi, I’m trying to run this code but I ‘m getting the follow error

Invoke-AzVMRunCommand : A parameter cannot be found that matches parameter name ‘ScriptString’.

]]>
By: sahal https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-884358 Tue, 18 Oct 2022 21:25:07 +0000 https://www.thomasmaurer.ch/?p=24068#comment-884358 In reply to David.

you can save your Powershell script in a Blob and then before you run the Invoke-AzVMRunCommand, download the .ps1 file to the runbook temp folder

]]>
By: Thomas Maurer https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-883995 Sat, 01 Oct 2022 09:22:37 +0000 https://www.thomasmaurer.ch/?p=24068#comment-883995 In reply to David.

Yes, but you would need to build a script to download the file on to the machine and then run it.

]]>
By: David https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-883966 Thu, 29 Sep 2022 12:52:53 +0000 https://www.thomasmaurer.ch/?p=24068#comment-883966 one question can run the code in the block or just run a .ps1 that on a blob ?

]]>
By: Matthias https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-882107 Thu, 01 Sep 2022 13:58:55 +0000 https://www.thomasmaurer.ch/?p=24068#comment-882107 In reply to Ryan.

Hi Ryan,

please try to send the invoke-azvmruncommand to a variable. You can then read the (output) message from this variable….

$result = Invoke-AzVMRunCommand ….

If ($result.Value.Count -gt 0) { Write-Output $result.Value[0].Message }

Have fun….

]]>
By: Ryan https://www.thomasmaurer.ch/2022/08/schedule-and-run-powershell-scripts-for-azure-vms-using-azure-automation/#comment-881935 Tue, 23 Aug 2022 16:50:53 +0000 https://www.thomasmaurer.ch/?p=24068#comment-881935 Thanks for the detailed write-up. Question: is there a way to return the output of the script executed against each VM in the Azure portal? For example, I’d like to run the ‘uptime’ command across my fleet and have those results appear in the output for the playbook. Thanks in advance.

]]>