Update-management pre/post scripts official scripts broken?

Obr 21 Reputation points
2021-02-02T12:56:56.03+00:00

Hi,

I've got a few hundred computers to update with Update-management. Most of these have auto-shutdown and auto-start enabled, and I don't want to disrupt that schedule.

So I decided to follow the official docs (https://learn.microsoft.com/en-us/azure/automation/update-management/pre-post-scripts) to configure startup before windows patches and shutdown after the maintenance window completes by using pre/post scripts:

63061-image.png

The only description for the runbooks are to install the ThreadJobs module, which I have done. In addition I have updated all the modules.

But the scripts fail with:

At line:95 char:2 + var msDocs = { + ~~~ The 'var' keyword is not supported in this version of the language. At line:97 char:25 + timeOrigin: Date.now(), + ~ An expression was expected after '('. At line:121 char:30 + hasRecommendations: false, + ~ Missing expression after ',' in pipeline element. At line:153 char:11 + </header> </div> + ~ The '<' operator is reserved for future use. At line:179 char:12 + <!-- <content> --> + ~ The '<' operator is reserved for future use. At line:198 char:12 + <!-- </content> --> + ~ The '<' operator is reserved for future use. At line:255 char:11 + Light </span> + ~ The '<' operator is reserved for future use. At line:279 char:10 + Dark </span> + ~ The '<' operator is reserved for future use. At line:303 char:19 + High contrast </span> + ~ The '<' operator is reserved for future use. At line:308 char:9 + </div> </div> + ~ The '<' operator is reserved for future use. Not all parse errors were reported. Correct the reported errors and try again

None of the links in the runbook (which are HTML/.js code, why is it categorized as a powershell runbook?) gives me any information.

How are you suppose to make these runbooks work?

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,368 questions
0 comments No comments
{count} votes

Accepted answer
  1. Stanislav Zhelyazkov 28,426 Reputation points MVP Volunteer Moderator
    2021-02-02T14:41:40.537+00:00

    Hi,
    It looks like that you have not imported these scripts properly. The extensions of the files are not .js but rather .ps1.
    In the UI you have option to import scripts from runbook gallery. Make sure to choose GitHub or PowerShell Gallery as source. It should import fine from there.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Obr 21 Reputation points
    2021-02-03T09:26:02.053+00:00

    Thank you stan!

    Can't believe I didn't see that setting.
    Worked like charm now.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.