Jan 06 2022 11:30 AM - edited Jan 06 2022 11:31 AM
I am automating Windows Updates on remote servers. I am using the PSWindowsUpdate module to make the updates. My question is regarding this error:
Install-WindowsUpdate : Missing SmtpServer; Use -PSWUSettings or declare PSWUSettings.xml in ModuleBase path.
I created the required PSWUSettings.xml file in the "C:\Program Files\WindowsPowerShell\Modules\PSWindowsUpdate" folder but I can't get the Install-WindowsUpate command to use it.
My question is then how do I 'declare' the PSWUSettings.xml file for the Install WindowsUpdate command to reference?
Thanks for your help.
Jan 17 2022 01:43 PM
It's a format like below I guess (https://github.com/Ichigo49/psh-tools/blob/master/lib/Modules/PSWindowsUpdate/2.0.0.0/PSWUSettings.x...)
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>System.Collections.Hashtable</T>
<T>System.Object</T>
</TN>
<DCT>
<En>
<S N="Key">Port</S>
<S N="Value">25</S>
</En>
<En>
<S N="Key">SmtpServer</S>
<S N="Value">smtpwawa.server.pl</S>
</En>
<En>
<S N="Key">To</S>
<S N="Value">Email address removed</S>
</En>
<En>
<S N="Key">From</S>
<S N="Value">Email address removed</S>
</En>
</DCT>
</Obj>
</Objs>
Jan 19 2022 08:39 AM
Thanks for the information. The XML file with those settings was created in the module's folder.
The question regards how to declare the PSWUSettings.xml in the Powershell command line.
Here is the error message I received.
Install-WindowsUpdate : Missing SmtpServer; Use -PSWUSettings or declare PSWUSettings.xml in ModuleBase path.
Thanks
Jan 19 2022 09:51 AM - edited Jan 19 2022 02:08 PM
@LL10890 Sorry, my bad :) It should be in a hashtable format, command should be something like
Install-WindowsUpdate -ComputerName nysrv1 -MicrosoftUpdate -AcceptAll - IgnoreReboot -SendReport –PSWUSettings @{SmtpServer="smtp.woshub.com";From="Email address removed";To="Email address removed";Port=25} -Verbose
(http://woshub.com/pswindowsupdate-module/)
Jan 27 2022 08:47 AM