I am unable to test this but it looks like you are unable to get the variable to pass through to the scriptblock. I would recommend trying something like this.
$DCs = [DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() |
Select-Object -ExpandProperty DomainControllers |
Select-Object -ExpandProperty Name
###Get kb status all DCs ###
Foreach ($DC in $DCS){
Invoke-Command -ComputerName $DC {
Get-HotFix -Id KB5013941 -ComputerName $using:DC
}
}
Actually you don’t need to specify the parameter -ComputerName inside the script block of Invoke-Command when you already specified the parameter -ComputerName outside of it.