Update Management - Turn On VMs

This is an example script for Update Management pre/post actions. It requires the ThreadJobs module. starts VMs which aren't currently running to install updates. It can be used in conjunction with UpdateManagement-TurnOffVMs to turn off the machines which were started.

4.5 Star
5,889 times
Add to favorites
Windows Azure
E-mail Twitter del.icio.us Digg Facebook
  • ThreadJobs module missing
    2 Posts | Last post September 12, 2019
    • It was said it requires ThreadJobs module. How can I get this module into VM where job is being scheduled?
      I tried to install it by adding these lines to the script:
          Install-PackageProvider -Name NuGet -MinimumVersion -Force -confirm:$false
          Install-Module -Name ThreadJob -RequiredVersion 1.0 -Force -confirm:$false
      Unfortunately got error:
       ..."A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: PowerShellGet requires NuGet provider version '' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\Client\AppData\Roaming\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion -Force'. Do you want PowerShellGet to install and import the NuGet provider now?"...
    • So I managed to install ThreadJob module manually by automation account "Modules" section
  • Weird Charaters when importing from Runbook Gallery
    5 Posts | Last post March 15, 2019
    • When importing from the Azure Automation Runbook Gallery, this script has some odd characters on rows 125 and 180.  These characters have replaced hyphens.  
      Row 124-125
      #This is used to store the state of VMs
      New-AzureRmAutomationVariable -ResourceGroupName $ResourceGroup –AutomationAccountName $AutomationAccount –Name $runId -Value "" –Encrypted $false
      Row 179-180
      #Store output in the automation variable
      Set-AutomationVariable –Name $runId -Value $updatedMachinesCommaSeperated
    • I hit the same problem as Robert Angell. This problem has existed for months.
    • I too have just hit the same problem. Can this be fixed at the source, please?
    • sorry, I have no idea what caused that. I fixed it. 
    • No problem, thank you very much for fixing. :)