need some help with my dashboard
. I played arround with WMI for Windows to get some data from my host. I used this to connect to my host:
$pc = "192.168.xxx.xxx"; //IP of the PC to manage
$WbemLocator = new COM ("WbemScripting.SWbemLocator");
$WbemServices = $WbemLocator->ConnectServer($pc, 'root\\cimv2', 'username', 'password');
$WbemServices->Security_->ImpersonationLevel = 3;
$wmi_disks = $WbemServices->ExecQuery("Select * from Win32_LogicalDisk");
$wmi_computersystem = $WbemServices->ExecQuery("Select * from Win32_ComputerSystem");
$wmi_operatingsystem = $WbemServices->ExecQuery("Select * from Win32_OperatingSystem");
$wmi_networkadapter = $WbemServices->ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPENabled = 'True'");
i can display the ip adress and some other things.
My Problem is that i can not display the free space from my hosts hard drive. How can i get this code to work with my host:
$fso = new COM('Scripting.FileSystemObject');
$D = $fso->Drives;
$type = array("unbekannt","herausnehmbar","Festplatte","Netzwerk","CD-ROM","RAM Disk");
foreach($D as $d ){
$dO = $fso->GetDrive($d);
$s = "";
if($dO->DriveType == 3){
$n = $dO->Sharename;
}else if($dO->IsReady){
$n = $dO->VolumeName;
$s = file_size($dO->FreeSpace) . " frei von: " . file_size($dO->TotalSize);
}else{
$n = "[Geräte mit Wechselmedien]";
}
echo "Drive " . $dO->DriveLetter . ": - " . $type[$dO->DriveType] . " - " . $n . " - " . $s . "
";
}
function file_size($size)
{
$filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
return $size ? round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i] : '0 Bytes';
}
i used PHP.