Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

The steps for the recipe are as follows:

  1. Create a WSUS computer target group for the Domain Controllers:
      $WSUSServer = Get-WsusServer
$WSUSServer.CreateComputerTargetGroup('Domain Controllers')
  1. Add a computer to the new computer target group:
      Get-WsusComputer -NameIncludes DC1 |
Add-WsusComputer -TargetGroupName 'Domain Controllers'
  1. 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