# 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:** 8\
**Page:** 2

<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 8, 2021, 12:45pm UTC](https://forums.powershell.org/t/windows-updates/17166/21 "2021-08-08T12:45:38Z")

</div>

Well there are lots of questions I have, so I figured that opening many thread might not be the solution.

---

<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 8, 2021, 3:03pm UTC](https://forums.powershell.org/t/windows-updates/17166/22 "2021-08-08T15:03:06Z")

</div>

> [@xMeme123x](#):
>
> Well there are lots of questions I have,

To make it a simple rule for you - **one** thread for **one** issue you have with code you wrote by yourself. 😉 Until now you did not post any line of code you have problems with.

In general: It is beyond the scope of this (or any) forum to teach you step by step how to write PowerShell scripts. We actually expect you to learn the very basic of PowerShell by yourself first.

Then if you have an issue with your code you should first try to solve it by yourself. Google it, search in forums like this or on MSFT or search StackOverflow. If you didn’t find a solution there you are very welcome to post your question here (or in any other forum) including the code you wrote along with the errors if there are some and an explanation of the environment if suitable. Then we will be happy to assist you and help you further.

If you use modules, scripts or code from other people and you have problems with it you should first ask the author for help. If you found a bug in their code they even will be happy about your finding I think.

---

<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 10, 2021, 2:03pm UTC](https://forums.powershell.org/t/windows-updates/17166/23 "2021-08-10T14:03:54Z")

</div>

Well, first of all, this thread was solely created for the purpose of being able to run the windows updates via a powershell script.

And the error I receive belongs to an excercise I’m doing in order to learn powershell. I never expected to learn it step by step here (as if anybody had the patience lol)

As expected, a few things are in germen because the book is, I can translate it if that helps other people understanding it better. Anyway, since using one thread for multiple issues isn’t allowed, I’d rather have this thread then be for the error message.

[1\_Basiswissen/ErsteSchritte/LocalUser\_Create.ps1]

### PowerShell-Script

### Lokales Benutzerkonto anlegen

### (C) Robin da Silva Martins

# Eingabewerte

$Name = “”  
$Accountname = “”  
$Description = “Powershell lernen und Kenntnisse erweitern”  
$Password = “”  
$Computer = “localhost”

“Anlegen des Benutzerskonto $Name auf $Computer”

# Zugriff auf Container mit der COM-Bibliothek ''Active Directory Service Interface"

$Container = [ADSI] “WinNT://$Computer”

# Benutzer anlegen

$objUser = $Container.Create(“user”, $Accountname)  
$objUser.Put(“Fullname”, $Name)  
$objUser.Put(“Description”, $Description)

# Kennwort setzen

$objUser.SetPassword($Password)

# Änderung speichern

$objUser.SetInfo()

“Benutzer angelegt: $Name auf $Computer”

Error message:

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

---

<div class="post-metadata">

**Author:** ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)\
**Post date:** [August 10, 2021, 2:18pm UTC](https://forums.powershell.org/t/windows-updates/17166/24 "2021-08-10T14:18:10Z")

</div>

It looks like you are trying to set an empty password, which is pretty much verboten on any secure operating system.

---

<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 10, 2021, 3:01pm UTC](https://forums.powershell.org/t/windows-updates/17166/25 "2021-08-10T15:01:48Z")

</div>

> [@xMeme123x](#):
>
> As expected, a few things are in germen because the book is

There are some German forums dedicated to PowerShell scripting. You might post your questions there. Sometimes it is easier to be able to ask your questions in your native language. 😉

If you’re interested:

> **[Windows Forum — Scripting](https://www.mcseboard.de/forum/71-windows-forum-%E2%80%94-scripting/)**
>
> Alles zum Thema System Administration Scripting — Q & A zum Thema Scripting: Batch, VBS, VBA, WMI, PowerShell

or this:  
[https://social.technet.microsoft.com/Forums/de-DE/home?forum=powershell\_de](https://social.technet.microsoft.com/Forums/de-DE/home?forum=powershell_de)

Regardless of that - again, please, when you post code or error messages format it as code using the _preformatted text_ button ( **\</\>** ).  
Thanks in advance.

It seems like you have some comments in your script without actually making them proper comments with the “`#`” sign. PowerShell tries to interpret everything as code what’s not after a “`#`” sign on the same line or beween “`<#`” and “`#>`”.

So when your script actually starts with

```auto
[1_Basiswissen/ErsteSchritte/LocalUser_Create.ps1]

```

it cannot work as this is no PowerShell code. 😉 So you either remove everything what’s “_not code_” from your script or you make each single line what’s _not code_ a comment by adding a “`#`” at the beginning of the line.

---

<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 14, 2021, 5:37pm UTC](https://forums.powershell.org/t/windows-updates/17166/26 "2021-08-14T17:37:02Z")

</div>

First of all, thanks for the feedback so far.

I removed the password on purpose, so you shouldn’t pay too much attention to that.

This was the first forum I found regarding PowerShell, so I took it.

The weird thing about all this is that the entire code was already given within the book I received, so all I did was write it down. So the code from the book was already wrong to begin with? Oo

And thank you for the link to a german forum, saves me the trouble of having to translate my written code.

---

<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 14, 2021, 5:39pm UTC](https://forums.powershell.org/t/windows-updates/17166/27 "2021-08-14T17:39:32Z")

</div>

> [@xMeme123x](#):
>
> So the code from the book was already wrong to begin with? Oo

Probaby not. But when you accidently treat normal text like code and try to run it it will not work. 😉

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:21pm UTC](https://forums.powershell.org/t/windows-updates/17166/28 "2024-05-16T20:21:59Z")

</div>



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