Grangato 0 Posted March 31, 2011 (edited) I was working on creating a Gui so I could monitor the free space and drives for the servers in our network. So far I was able to do so with a basic setup This is what I have so far. #include <GuiConstants.au3> $GUI=GUICreate("Free Drive Space Validation",500,200) $sNotify = IniRead("Drvconfig.ini","Servers", "01", "NotFound") $DRIVE=DriveSpaceFree("\\"&$sNotify&"\C$") $B=1024 $SPACELEFT=$DRIVE/$B $SPACELEFTR=Round($SPACELEFT,2) $SPACELEFTF=StringTrimRight($SPACELEFTR,3) GUICtrlCreateLabel($sNotify& " " & $SPACELEFTF & " GB",10,25) GUISetState() Do $MSG=GUIGetMsg() Until $MSG=$GUI_EVENT_CLOSE What I would like to do is to have a server list with drives specified for each server, then bring back the details for each server and drives within. Any suggestions welcome. Edited March 31, 2011 by Grangato Share this post Link to post Share on other sites
UEZ 1,278 Posted March 31, 2011 (edited) You can use WMI to get free space from remote systems.Search forum for e.g. FreeSpace Win32_LogicalDiskI wrote long time ago a command line tool to read several information from remote systems -> SIC2Br,UEZ Edited March 31, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
hannes08 39 Posted March 31, 2011 Hi Grangato, you could change your IniRead to IniReadSection. Build up your INI like this: [servers] server1=c$ server1=d$ server2=c$ server2=d$ IniReadSection returns a 2D Array, so you'll need to add a loop here and a loop there: #include <GuiConstants.au3> $a_data = IniReadSection("settings.ini", "servers") $B = 1024 Dim $a_space[$a_data[0][0] + 1] $a_space[0] = $a_data[0][0] $GUI = GUICreate("Free Drive Space Validation", 150, 40 + $a_space[0] * 25) For $i = 1 To $a_space[0] $a_space[$i] = DriveSpaceFree("\\" & $a_data[$i][0] & "\" & $a_data[$i][1]) GUICtrlCreateLabel($a_data[$i][0] & ":" & $a_data[$i][1] & ": " & Round($a_space[$i] / $B, 2) & " GB", 10, 25 * $i - 1) Next GUISetState() Do $MSG = GUIGetMsg() Until $MSG = $GUI_EVENT_CLOSE Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Share this post Link to post Share on other sites
Grangato 0 Posted April 1, 2011 (edited) Thanks guys for your quick turn around. I was able to verify Hannes response and this is definantly what I was hoping for. I am planning on adding some other information as well. I will verify UEZ's response as well. Edited April 1, 2011 by Grangato Share this post Link to post Share on other sites
Grangato 0 Posted April 8, 2011 Hannes, Been trying to get your code to write the array to an excel file for each sever entry since the GUICREATELABEL creates a GUI way too big to view. I was able to write to a list view, but I haven't been able to get it to write to an excel file with the Headers "Server" "Total Space" "Free Space." #include <GuiConstants.au3> $a_data=IniReadSection("Drvconfig.ini", "Servers") $B=1024 Dim $a_space[$a_data[0][0]+1] $a_space[0]=$a_data[0][0] Dim $a_drive[$a_data[0][0]+1] $a_drive[0]=$a_data[0][0] $GUI=Guicreate("Free Drive Space Validation", 500, 400) GLOBAL $View=GUICtrlCreateTreeView(10,30,290,350) GUICtrlCreateLabel("Server Name" & " " & "Free Space",10,10) For $i = 1 To $a_space[0] $a_space[$i]=DriveSpaceFree("\\" & $a_data[$i][0] & "\" & $a_data[$i][1]) $a_drive[$i]=DriveSpaceTotal("\\" & $a_data[$i][0] & "\" & $a_data[$i][1]) $1=$a_data[$i][0] $2=StringLeft($a_data[$i][1],1) $3=Round($a_space[$i] / $B, 2) $4=Round($a_drive[$i] / $B, 2) GUICtrlCreateTreeViewItem($1&" "&$2&" "&$3&" GB "&$4&" GB",$View) Next GUISetState() Do $MSG = GUIGetMsg() Until $MSG = $GUI_EVENT_CLOSE Share this post Link to post Share on other sites