Jump to content

Recommended Posts

Hi guys, basically my current situation is that the client will need to run the audit services batch file from the web server.

 

My problem is that although the code below executed successfully, the .bat batch file outputs the result of the server's side computer configuration. I would like it to output the service result of the client side because i want to audit the client side and not the web server side.  How do i go about doing that?

 

<?php
echo exec('cmd /c 4.1_services.bat');
?>

 

Contents of batch file

@echo off

sc qc Alerter | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc wuauserv | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc BITS| findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc Clipsrv | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc Browser | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc Fax | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc IISADMIN | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc ciSvc | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc Messenger | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc Netlogon  | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc mnmsrvc| findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc RDSessMgr| findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc RemoteRegistry | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc RemoteAccess| findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc SMTPSVC | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc SNMP | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc SNMPTRAP | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc Schedule | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc TlntSvr | findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc TermService| findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc upnphost| findstr "START_TYPE DISPLAY_NAME" >>hi.txt
sc qc w3svc | findstr "START_TYPE DISPLAY_NAME" >>hi.txt

 

Link to comment
https://forums.phpfreaks.com/topic/207706-running-batch-file-on-client-side/
Share on other sites

Actually i have another method which is using Force Downloading but however, my project requires me to auto run the batch file when the user saves the script....how do i go about doing that?

 

<?PHP
// Define the path to file
$file = '4.4_File_Permission.bat';


if(!file)
{
     // File doesn't exist, output error
     die('file not found');
}
else
{

     // Set headers
     header("Cache-Control: public");
     header("Content-Description: File Transfer");
     header("Content-Disposition: attachment; filename=$file");
     header("Content-Type: application/bat");
     header("Content-Transfer-Encoding: ASCII");
    
     // Read the file from disk
     readfile($file);

}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.