Do script block based on more than 1 condition?

Hey all

How can I change the below to include an “and” ( eg to complete, once both capabilities have been installed?

do {

Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools0.0.1.0 -ErrorAction Ignore | Out-Null
Add-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools -ErrorAction Ignore | Out-Null
until ((Get-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools~~~~ -eq ‘Installed’)


do {
    Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~ -ErrorAction Ignore | Out-Null
    Add-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools~~~~ -ErrorAction Ignore | Out-Null
    Start-Sleep -Seconds 1
until (
    (Get-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~ -eq ‘Installed’ -and
    (Get-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools~~~~ -eq ‘Installed’

Thank you Sam exactly what I was looking for.



These commands run in the background?

Yes we have a weird intermittent issue on our Firewall, this gets around it/workaround.