![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=1739007586-KK0efOnvGkURgzgODR1B3Mau1Sj7exWn-0-70ca08ac0bc64f35a2a96bb27cea7d12)
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=1739007586-2v3ONvMmFE3Bd7yEovoAAc2vMN8MG4mR-0-4fda25b64b5aec91ae8afb4e7cef1e07)
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=1739007586-6ONik8ZdD5hiF8JJ0bpPxCRt9oHenzol-0-765a80d050501a5fa1ee9af712231443)
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=1739007586-Xs7JrdG0St9DH0d6s0rNQiUxEJ6P1FQK-0-d1eec636e3f88d8578326c06ea8a4c9b)
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=1739007586-Bn52kIZMSNgLcMVoK3WZJmbammwlHwCf-0-4269c9333a3847fc32f20f8691f3d982)
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=1739007586-E4EPIqbMnzTVc0ojiXWdVi42w6ijLMjB-0-c5cdbe10e6e98ca337590fe834c9d17a)
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=1739007586-1Uy4oLrchkSIls7Db14fzOtNKHn64v7G-0-6e422eb95d2676dbe8e156153ba12753)
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=1739007586-4aYG2y7SkVce9o14DYrOkKfzXGeo5tLy-0-5238f06868b82d7b4bb193fd2ac001f9)
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=1739007586-Ujmf5yz0afknFOE1GAuGDcRgVo5KfaGg-0-ca5a1c433b4076bfa40bf644042330cb)
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=1739007586-LEXmsLdXbTfCJB1uiHiQhZnccG9mxBO6-0-a854096f756cf8fe21695369bc0758d8)