for some reason, this will shutdown remote PCs, but when I try to LOGOFF remote machines, the local machine logs off

code:
 Function RemoteLRS($computer,$x)
dim $oWBEM, $oShutdown, $oOpSys
; 0 - LogOff 4 - Force LogOff
; 2 - Reboot 6 - Force Reboot
; 8 - Shutdown 12 - Force Shutdown
$oWBEM = GetObject('winmgmts:{(Shutdown)}!\\$computer\root\CIMV2')
$oShutdown = $oWBEM.ExecQuery('Select * from Win32_OperatingSystem where Primary=true')
if $oShutdown.count
For Each $oOpSys in $oShutdown
$RemoteLRS=$oOpSys.Win32Shutdown($x)
Next
endif
$oShutdown=0 $oWBEM=0
endfunction

_________________________
How to ask questions the smart way <-----------> Before you ask