how to set Timeout for long running powershell commands

  powershell, windows

Please help me to break the command for long running powershell command (need to set timeout), i a trying to install windows patches via powershell, for few servers its getting hanged for more then 2hrs, i want to break the session and move for next task. I also tried with start-job but no luck, i am not familar with powershell.

"Install-WindowsUpdate -AcceptAll -Install -IgnoreReboot -Category ‘Security Updates’,’Critical Updates’"


"Get-WUInstall -AcceptAll -Install -IgnoreReboot -Category ‘Security Updates’,’Critical Updates’"

Source: Windows Questions