- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Thomas Lee
- 69字
- 2021-07-02 18:15:53
How to do it...
The steps for the recipe are as follows:
- Create a WSUS computer target group for the Domain Controllers:
$WSUSServer = Get-WsusServer
$WSUSServer.CreateComputerTargetGroup('Domain Controllers')
- Add a computer to the new computer target group:
Get-WsusComputer -NameIncludes DC1 |
Add-WsusComputer -TargetGroupName 'Domain Controllers'
- List the clients in the computer target group:
$DCGroup = $WSUSServer.GetComputerTargetGroups() |
Where-Object -Property Name -eq 'Domain Controllers'
Get-WsusComputer |
Where-Object -Property ComputerTargetGroupIDs
-Contains $DCGroup.Id