When i try to run invoke-command for every computer in Active-Directory , i will encounter the following error : "Invoke-Command : One or more computer names are not valid. If you are trying to pass a URI, use the -ConnectionUri parameter, or pass URI objects instead of strings. "
```
$Hosts_Array=Get-ADComputer -Properties CN -Filter * | Sort-Object | Select-Object CN
foreach ($i in $Hosts_Array) {
Invoke-Command -ComputerName $i -ScriptBlock { Get-Service -Name "sysmon64"}
}
```
I use the For loop to run the command for every computer that fetch from the AD.