# Windows Updates

**URL:** <https://forums.powershell.org/t/windows-updates/17166>\
**Category:** PowerShell Help\
**Created:** [July 26, 2021, 8:40am UTC](https://forums.powershell.org/t/windows-updates/17166 "2021-07-26T08:40:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [July 26, 2021, 8:40am UTC](https://forums.powershell.org/t/windows-updates/17166/1 "2021-07-26T08:40:55Z")

</div>

Hello,

I’m pretty much a beginner when it comes to Powershell and just recently, I was tasked with writing a script that enables the computer to download and install updates automatically.

This script is then supposed to be deposited within the Taskplaner.

And I could use some help with structuring and writing this script. 🙂

Kinda regards.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 26, 2021, 8:56am UTC](https://forums.powershell.org/t/windows-updates/17166/2 "2021-07-26T08:56:00Z")

</div>

Robert,

Welcome to the forum. 👋🏽

Did you try to search for a script first before you came here? Questions like this have been asked a lot of times before and have been answered a lot of time before.

Regardless of that - instead of a potentially quirky and error prone beginner script you should urgnetly consider using WSUS. It is free of charge and it is made for managing updates for Windows clients and server.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [July 26, 2021, 9:51am UTC](https://forums.powershell.org/t/windows-updates/17166/3 "2021-07-26T09:51:00Z")

</div>

I did already search for a potential script but couldn’t really find anything useful.

Most of the results were based on WSUS indeed.

However, I didn’t want to simply copy a script because otherwise, my colleagues would probably notice this because it would be too advanced for a known beginner like me, hence why I hestiated to do this.

Whenever I tried to install WSUS for Powershell, I’d receive an error saying that it wasn’t recognized as a proper cmd.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 26, 2021, 10:16am UTC](https://forums.powershell.org/t/windows-updates/17166/4 "2021-07-26T10:16:41Z")

</div>

> [@xMeme123x](#):
>
> However, I didn’t want to simply copy a script because otherwise, my colleagues would probably notice this because it would be too advanced for a known beginner like me, hence why I hestiated to do this.

If this is a homework assignment or something like this you should discuss the task with your tutor/mentor/teacher. To replace a sophisticated, robust and industry wide common solution with a beginner script is actually a bad idea.

> [@xMeme123x](#):
>
> Whenever I tried to install WSUS for Powershell, I’d receive an error saying that it wasn’t recognized as a proper cmd.

If you have code giving you errors you should post this code here along with the error messages and we can try to help you.

Please always format code, error messages, cosnole output or sample data as code using the _preformatted text_ button ( **\</\>** ).

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [July 27, 2021, 5:49am UTC](https://forums.powershell.org/t/windows-updates/17166/5 "2021-07-27T05:49:54Z")

</div>

It’s no homework, it’s for the improvement of the company I work for. The thing is that the occuring error message is in german, hence why I didn’t post it here in the first place.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 27, 2021, 5:59am UTC](https://forums.powershell.org/t/windows-updates/17166/6 "2021-07-27T05:59:40Z")

</div>

> [@xMeme123x](#):
>
> It’s no homework, it’s for the improvement of the company I work for.

Please don’t get me wrong … do you really think you could make it any better than Microsoft can with WSUS? 😉

> [@xMeme123x](#):
>
> The thing is that the occuring error message is in german, hence why I didn’t post it here in the first place.

First of all - you could have translated it. 😉 And second - there are some Germans around here. Das weiß ich aus sicherer Quelle. 😛

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [July 27, 2021, 11:14am UTC](https://forums.powershell.org/t/windows-updates/17166/7 "2021-07-27T11:14:02Z")

</div>

Ich habe nie behauptet, dass das Skript WSUS ersetzen soll, selbst beim Installieren davon taucht dieser Fehler auf. 😉 Vor allem geht es darum, dass man einen Lerneffekt mit drin hat. Soweit ich das verstehe, muss man bei WSUS gar nicht viel selbst machen. ^^

Es sollen lediglich Updates automatisiert laufen, was wiederum zur Verbesserung führt → Verbesserung des Unternehmens.

Es zu übersetzen wäre langwierig gewesen und konnte ja nicht wissen, dass hier auch deutschsprachige Personen sind, wenn alles in Englisch verfasst ist. ^^

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [July 27, 2021, 11:19am UTC](https://forums.powershell.org/t/windows-updates/17166/8 "2021-07-27T11:19:09Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/8/8a277b789b99e11f74451b4308de060b718f063c.png)

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 27, 2021, 2:41pm UTC](https://forums.powershell.org/t/windows-updates/17166/9 "2021-07-27T14:41:39Z")

</div>

> [@xMeme123x](#):
>
> konnte ja nicht wissen, dass hier auch deutschsprachige Personen sind

Es bleibt aber trotzdem immernoch ein englisches Forum und deswegen machen wir auch bitte in Englisch weiter.

I’m not experienced with WSUS - we use SCCM to deploy updates - but I think you have a misconception about the WSUS PowerShell module. As far as I understood comes the module together with the installation of the WSUS server. The cmdlets are not meant to be used on clients. They are designed to manage the server.

You may find other modules in the [PowerShellGallery](https://www.powershellgallery.com/packages?q=Tags%3A%22Wsus%22) they do what you want. But I’d recommend to use the built in mechanisms to deploy and install updates on clients. I’d expect these to be more robust and reliable than a script.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [July 29, 2021, 9:15am UTC](https://forums.powershell.org/t/windows-updates/17166/10 "2021-07-29T09:15:44Z")

</div>

Okay.

It looks like we are talking past each other or I’m simply bad at expressing myself.

I can see why you think that WSUS is the solution, however, keep in mind that the script I would write will be checked thoroughly before going into action. Like I said: the task is to write a script and learn powershell and not use already configured clients / server to do the job for me. 🙂

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 29, 2021, 10:54am UTC](https://forums.powershell.org/t/windows-updates/17166/11 "2021-07-29T10:54:55Z")

</div>

> [@xMeme123x](#):
>
> It looks like we are talking past each other or I’m simply bad at expressing myself.

Maybe a little bit of both. 😉

> [@xMeme123x](#):
>
> Like I said: the task is to write a script and learn powershell and not use already configured clients / server to do the job for me.

OK, but as I already said I think you’re using the wrong tool. The cmdlets you try to use - according to the error messages you posted - are usually not available on clients. They are meant to be used to manage the WSUS server.

That’s why I recommended to search the PowerShellGallery for a module offering the functionality you need.

But maybe I’m wrong. You should post the command you used to install the WSUS module and the error messages you get.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [August 2, 2021, 5:38am UTC](https://forums.powershell.org/t/windows-updates/17166/12 "2021-08-02T05:38:54Z")

</div>

I’m not quite sure but I think it was this one.

Install-WindowsFeature UpdateServices

I have also been given a powershell book, thus learning it step by step, I’m currently trying to create my very own user, but also have a few issues here and there.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 2, 2021, 6:21am UTC](https://forums.powershell.org/t/windows-updates/17166/13 "2021-08-02T06:21:19Z")

</div>

> [@xMeme123x](#):
>
> I’m not quite sure but I think it was this one.

??? Really?

> [@xMeme123x](#):
>
> Install-WindowsFeature UpdateServices

WSUS is a feature and with this command you would install it _ **ON A SERVER** _!

> [@xMeme123x](#):
>
> I have also been given a powershell book, thus learning it step by step, I’m currently trying to create my very own user, but also have a few issues here and there.

I don’t know what to answer you: This has nothing to do with your initial question.

If you want to get help you should ask a specific question about a particular piece of code you wrote and you have issues with. In this case you should post this piece of code here (fomratted as code) along with the error messages you might get (formatted as code) and/or a description what is or how is it not working as expected.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [August 3, 2021, 6:32pm UTC](https://forums.powershell.org/t/windows-updates/17166/14 "2021-08-03T18:32:50Z")

</div>

Okay, will do so, just wait a bit.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [August 4, 2021, 6:30pm UTC](https://forums.powershell.org/t/windows-updates/17166/15 "2021-08-04T18:30:21Z")

</div>

So, in order for us to get back to the windows updates.

Since the codes I’m working with have absolutely nothing to do with my initial question, I’d like to refrain from them completely.

Do you have an example for a script that could initiate the windows updates? Like I said, I’m supposed to write the code myself and am still learning.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 4, 2021, 8:41pm UTC](https://forums.powershell.org/t/windows-updates/17166/16 "2021-08-04T20:41:31Z")

</div>

[https://www.google.com/search?q=script+that+could+initiate+the+windows+updates&oq=script+that+could+initiate+the+windows+updates&aqs=chrome..69i57.545j0j4&sourceid=chrome&ie=UTF-8](https://www.google.com/search?q=script+that+could+initiate+the+windows+updates&oq=script+that+could+initiate+the+windows+updates&aqs=chrome..69i57.545j0j4&sourceid=chrome&ie=UTF-8)

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [August 5, 2021, 1:02pm UTC](https://forums.powershell.org/t/windows-updates/17166/17 "2021-08-05T13:02:30Z")

</div>

Thank you, but I’d still have to do that manually.

The script needs to work under the task planer and thus automatically and at a certain time / date. 🙂

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 5, 2021, 1:16pm UTC](https://forums.powershell.org/t/windows-updates/17166/18 "2021-08-05T13:16:45Z")

</div>

> [@xMeme123x](#):
>
> Thank you, but I’d still have to do that manually.

What exactly? You have to share what you’re refering to.

> [@xMeme123x](#):
>
> The script needs to work under the task planer and thus automatically and at a certain time / date.

If you found something fitting for you you have to set up your task planer to run it automatically.

---

<div class="post-metadata">

**Author:** ![xMeme123x](https://avatars.discourse-cdn.com/v4/letter/x/8edcca/32.png) [@xMeme123x](https://forums.powershell.org/u/xMeme123x)\
**Post date:** [August 6, 2021, 5:50am UTC](https://forums.powershell.org/t/windows-updates/17166/19 "2021-08-06T05:50:47Z")

</div>

I was refering to your solution, it’s still something I’d have to do manually.

No, I simply explained what I’m asking for and what the end result is supposed to be. 🙂

A different question regarding PowerShell: Just recently, I started to receive this error message when trying to run a script.

Missing type name after ‘[’.  
+ CategoryInfo : ParserError: ( ) , ParentContainsErrorRecordException  
+ FullyQualifiedErrorId : MissingTypename  
What does it mean exactly?

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 6, 2021, 6:45am UTC](https://forums.powershell.org/t/windows-updates/17166/20 "2021-08-06T06:45:56Z")

</div>

> [@xMeme123x](#):
>
> I was refering to your solution, it’s still something I’d have to do manually.

I did not post a solution. The link I shared was a Google search. This Google search brought up 3 or 4 promissing links to solutions regarding your task - at least it did when I searched for it.

> [@xMeme123x](#):
>
> Just recently, I started to receive this error message when trying to run a script.

Again: You should post the code you used when the error occured (formatted as code please) along with the complete error message (formatted as code please).

Regardless of that - it is recommended to open a new thread if you have a new question unrelated to the initial one.

[Next page](https://forums.powershell.org/t/windows-updates/17166.md?page=2)
