Geez, why so complicated?
Code:

$comps=COMNetView()
for each $comp in $comps
if $comp<>@WKSTA
$rc=fnWMIShutdown($comp,4)
endif
next
$rc=fnWMIShutdown(@WKSTA,4)

_________________________
There are two types of vessels, submarines and targets.