win32_query_Service_status
<p>I am trying to connect to a remote server Win 2003 using a PHP script I have come across from php.net below and returns error 5 which is permissions, the code works great when I query localhost.</p>

<p>Has anyone ever come across this issue before or know a work around? Once I know I can connect I plan to monitor services and then be able to restart them with monitor script.</p>

<pre><code>$servicename ="crmskidata"; 
$machine ="crm2011"; 
//print_r (win32_query_Service_status($servicename,$machine)); 

echo  $servicename; 

$sray = win32_query_Service_status($servicename,$machine); 

echo "&lt;br&gt;"; 

print_r ($sray); 

echo "&lt;ul&gt;"; 
echo "&lt;li&gt;Service Type: " .$sray[ServiceType] . "&lt;/li&gt;"; 
echo "&lt;li&gt;CurrentState: " .$sray[CurrentState] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Controls Accpeted: " .$sray[ControlsAccepted] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Win32 Exit Code: " .$sray[Win32ExitCode] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Service Specific Exit Code: " .$sray[ServiceSpecificExitCode] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Check Point: " .$sray[CheckPoint] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Wait Hint: " .$sray[WaitHint] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Process Id: " .$sray[ProcessId] . "&lt;/li&gt;"; 
echo "&lt;li&gt;Service Flags: " .$sray[ServiceFlags] . "&lt;/li&gt;"; 
</code></pre>
