![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=1739014111-NrpC5K98ozU0MMeHBd9wNSvKzQE9kPYm-0-f3850ee5fbb1d27f26a53d98b0d876bf)
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=1739014111-MCkx84OgoW55FSnt6fb9Ou0V3nqEk8T4-0-9894cffc30f679fec53b4e86ddad538d)
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=1739014111-LaCS54KX4dh36l1eDvj3RDHVa3kjNs0e-0-23d9ef18afa38140fe431d0ef107d2d7)
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=1739014111-xtx1jJXgPSaUYjSvEOhRd2njSievbTp5-0-80a861c0f0f5f7b0c6547d05c8af2d2f)
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=1739014111-6JIU1AAyxVHV7aVUjzEcY1WuPTD6RKLW-0-9f8da99b0b4422b8b81192f1fb7fcfd7)
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=1739014111-8kwAS43wXZANpt6kjJjYs2dZE6yfbvBP-0-3e3c0ec0c7699b0029d05c1c521becf5)
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=1739014111-QlMTcD9sBQ3wAItGuIjXsdn31b811VuV-0-c230aa5474507ebd17807a910adaf53e)
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=1739014111-SriwDoCPWzfvbVvhUmwvRDQbScW1qtsB-0-446998fdc8fdbd730ac8d4c77f63c3ea)
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=1739014111-oRY0pWoaAAgUjntZ45rUhyqGZ7aoN7N8-0-afca59e98cc4be2e5e2d8cc5b656efa9)
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=1739014111-f9cVtsc13mChntViUQS4QOilCIYrC9hF-0-44676645d50df722587147862f7b64f8)