mr_scooby 0 Junior Poster in Training

Hi, have this function below that gets the name of the pc, the local part works however the part that goes to the htpc fails, permission denied is the message.

I have set the same username/password as admin on both machines.

there must be some code I can use to send the credentials also?

any ideas greatly welcome.

function get_compter_name()
{
 alert('hi');
  //local pc
  var ax = new ActiveXObject("WScript.Network");
  document.write(ax.UserName + '<br />');
  document.write(ax.ComputerName + '<br />');
  //var object = new ActiveXObject("WScript.Shell");
  //object.Run("ipconfig.exe");
  // htpc
  try
  {
    var wmi = "winmgmts:\\\\192.168.1.10\\root\\cimv2";
    var query = ax.ComputerName;
    var processes = GetObject(wmi).ExecQuery(query);
    document.write(processes);
   }
   catch(e)
   {
      document.write('fail');       
   }

}