$pcs
= Get-ADComputer -Filter "Name -like '*'" | select-object name
$pccount =
$pcs.Count
$counter = 1
foreach ($pc in
$pcs) {
    $computername = $pc.name
    if(Test-Connection -ComputerName
$computername -Count 1 -Quiet){
        Try
        {
            Get-WmiObject -Class
win32_startupcommand -ComputerName $computername | select PSComputername,
@{l=",1";e={","}}, Name,
@{l=",2";e={","}}, Command, @{l=",3";e={","}},
Location | Format-Table -AutoSize
        }
        Catch
        {
            Write-Host $counter" of
"$pccount" Search Error "$computername" "$user"
"$_
        }
    }
    else{
        Write-Host $counter" of
"$pccount" Search Connection Failure "$computername
    }
    $counter++
}
 
No comments:
Post a Comment