Timeout session on stop-computer cmdlet


hey nerds,

i started automating things ps session & dont find timeout switch in stop-computer cmdlet. checked file, didnt find anthing.

is there way timeout session done?

do suggest.


cheers, alan.

ok, understand your problem - you're missing in stop-computer cmdlet option sets duration when the computer finally shuts down?

when issue, true stop-computer cmdlet has no parameter sets individual duration when computer shutdowns. but there little workaround - can use old "shutdown" dos command in script:

$startinfo = new-object system.diagnostics.processstartinfo $startinfo.filename = "shutdown.exe" $startinfo.arguments = "/s /t 240"  $process = new-object system.diagnostics.process $process.startinfo = $startinfo $process.start() | out-null $process.waitforexit()
 remark: script shutdowns computer in 4 minutes.   

let me know if solution you.   



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Indexing Server

Schannel Issue

oclist /xml or /?