![Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/733/36700733/b_36700733.jpg)
How it works...
In step 1, you install WSUS by installing the UpdateServices feature. Note the link for additional configuration instructions:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/9b3a70de-63ef-4e8e-8a9e-cd00df4032ed.png?sign=1739592049-jT2DRsoEcPhCuKjJDeXZgUMmxTEqtykn-0-4a591eca08c0d79b10a29b8a69bd5ef1)
In step 2, you review what has been installed on your server by piping the results of Get-WindowsFeature to Where-Object, which filters the object passed in the pipeline. This object is referenced by the $PSItem variable (or the shorter $_) variable, returning only those that are installed—that is, those whose Installed property is $true. Installing the UpdateServices Windows feature installed the prerequisites, such as Web Server (IIS), automatically:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/0733f78b-cc14-4b5b-a13f-f7fbf99bd1b3.png?sign=1739592049-luPw6nXjEqapB5gBmeKQvlVRyNdFwMxW-0-80afeccdd86b96e9eb088800e32eb02f)
In steps 3 and 4, you create a folder to hold the WSUS update content, and then perform the post-installation configuration for WSUS:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/d59e83c1-e00f-4562-b1cd-f7b6bb055c22.png?sign=1739592049-y3MgpW47eOWG39fJeq5F7ygyqhzPo7CH-0-600f1ef9303000ee6b863b3d401857ff)
In step 5, you review the log file written by WsusUtil.exe in the previous command. This log is useful for troubleshooting or for verifying a successful configuration:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/5f911a5d-516a-459a-9214-1c24426499ca.png?sign=1739592049-mwSIkc0iydHMsw6vhhylVEx0j0gKw9IY-0-52983af8a6b3e6410bd57dd98494d2ca)
In step 6, you view the websites on the WSUS1 server, noting the WSUS website, bound to HTTP on port 8530:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/136a5a06-4ec1-4f94-91c4-8838d23caaaf.png?sign=1739592049-bBID5n4KYzORlKdXxIA83NNZpNFb5J8w-0-56ea7631c429de606dc45cc0e144307a)
In step 7, you review the commands in the UpdateServices module, which you investigate in later recipes:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/f63384e1-beef-4f1d-9e36-72efa4c9bab5.png?sign=1739592049-B14FLUXLPUbo0vlQVFX9sa8vAJZZ7W0V-0-c8e64fe4f27b05d50305f7a5d08cd05f)
In steps 8 and 9, you use Get-WsusServer to create your $WSUSServer object and inspect the properties and methods:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/e52a75a8-902e-4a61-bf28-62768e85ea89.png?sign=1739592049-4U3y8JCa3krzW5o7SZVx6XMs1itqjA6S-0-ab0ab1ea7efb47b7642b0f8cd9599137)
In step 10, you use Get-WsusProduct to create and view the default collection of available product categories. Sadly, this list is out of date:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/38d804ee-f9b9-46d3-90f0-e619161b4374.png?sign=1739592049-3UBuDtlSGs03sQZzp2J5pPTeT2txJaTI-0-37b4c291a06279ae2e22968b5c685d86)
In step 11, you make your product categories current by synchronizing from the Microsoft Update servers, using a while loop to wait for the synchronization to complete. This can take several minutes when doing this for the first time:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/5abd7a79-8146-4046-9f14-52ea53948534.png?sign=1739592049-jasfcb0y6zX93h50xtepQI2ceYVU3B4c-0-453a1a4f90d4bd2655034168e11a6ee4)
In step 12, you check the result of the synchronization:
![](https://epubservercos.yuewen.com/7D2E6F/19470404008937606/epubprivate/OEBPS/Images/79fc050c-3a9b-4b61-9104-8ca93dea0a53.png?sign=1739592049-MtqWBVTri3B3Hg9DgOEtxVoP3hH38wTX-0-72b8c7fd2912e170cc0d4c093d1e74c9)