locked
PowerShell Workflow Timeout RRS feed

  • Question

  • Pinging all Windows Servers in Parallel returning an error

    The operation did not complete within the allotted timeout of 00:00:30. The time allotted to this operation may

    have been a portion of a longer timeout.

    At PingServers:9 char:9

    +

        + CategoryInfo          : InvalidResult: (:) [], TimeoutException

        + FullyQualifiedErrorId : JobStateFailed

     

    Script

    Import-Module ActiveDirectory
    $SrvOUPath = 'OU=Servers,DC=x,DC=xx,DC=xxx'
    $Servers = Get-ADComputer -SearchBase $SrvOUPath -Properties OperatingSystem -Filter * | Where { $_.OperatingSystem -like "*Windows*" } | select Name
    
    Workflow PingServers{
        Param ( $Computers )
        foreach -Parallel ($Computer in $Computers) {
            "$(Get-Date) $Computer : $(Test-Connection -ComputerName $Computer -Quiet -Count 1)"
        }
    }
    Write-Host "Starting: $(Get-date)"
    PingServers -Computers $Servers.Name
    Write-Host "Done: $(Get-date)"

     

    Noor

    Monday, August 26, 2013 4:22 PM

Answers

All replies

  • found the fix

    Changed the line to

    $Servers = Get-ADComputer -SearchBase $SrvOUPath -Properties OperatingSystem -Filter * | Where { $_.OperatingSystem -like "*Windows*" } | Select -ExpandProperty DNSHostName

    from here: http://blogs.technet.com/b/heyscriptingguy/archive/2012/11/20/use-powershell-workflow-to-ping-computers-in-parallel.aspx

    Noor

    Monday, August 26, 2013 4:28 PM
  • HI,

    We are happy that your issue has been resolved. And thanks for sharing solution with us. If you have any questions in future, you can continue to contact us.

    Thanks.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED> Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue.It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, August 28, 2013 1:15 AM