bonjour,
j'ai repris ce code pour afficher les espaces disqies de chacun de mes serveurs : http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_18210
alors ça marche bien avec \\localhost (<CFOBJECT TYPE="COM" ACTION="create" CLASS="Scripting.FileSystemObject" NAME="Application.fso" server="\\localhost">)
mais si pour l'argument server je mets une IP de serveur ou son nom ça me retourne toujours les espaces disques de mon serveur \\localhost...
est-il seulement possible de récupérer ces infos pour autre chose que le serveur local ou bien ai-je fait une erreur ?
Merci d'avance !
Mon code complet :
<style type="text/css">
<!--
.Style1 {
color: #FFFFFF;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
}
.Style2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
font-weight: bold;
color: #6666CC;
}
.Style3 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
}
-->
</style>
<cfquery name="getServeurs" datasource="new-intranet">
SELECT *
FROM SERVEUR_RZO
ORDER BY NOM_SERVEUR_RZO
</cfquery>
<table width="382" border="0" cellpadding="0" cellspacing="1" bgcolor="#333333">
<!--DWLayoutTable-->
<tr align="center" valign="middle" bgcolor="#6666CC">
<td height="34" colspan="5"><span class="Style1">Espaces disques des serveurs (GO)</span></td>
</tr>
<CFLOOP query="getServeurs">
<!--- Uncomment the following line if you must delete the object from the
Application scope during debugging. Then restore the comments.
This technique is faster than stopping and starting the ColdFusion server. --->
<!--- <cfset structdelete(Application, "fso")> --->
<cfset serveur_en_cours = "\\" & #IP_SERVEUR_RZO#>
<tr align="center" valign="middle" bgcolor="#FFFFFF">
<td height="25" colspan="5"><span class="Style2"><cfoutput>#NOM_SERVEUR_RZO# #serveur_en_cours#</cfoutput></span></td>
</tr>
<tr>
<td width="66" height="22" align="center" valign="middle" bgcolor="#CCCCCC"><span class="Style3">Lecteur</span></td>
<td width="77" align="center" valign="middle" bgcolor="#CCCCCC"><span class="Style3">Total</span></td>
<td width="74" align="center" valign="middle" bgcolor="#CCCCCC"><span class="Style3">Dispo</span></td>
<td width="80" align="center" valign="middle" bgcolor="#CCCCCC"><span class="Style3">Plein à</span></td>
<td width="85" align="center" valign="middle" bgcolor="#CCCCCC"><span class="Style3">Conclusion</span></td>
</tr>
<cfapplication name="comtest" clientmanagement="No" Sessionmanagement="yes">
<cfset fso_is_initialized = False>
<cflock scope="application" type="readonly" timeout="120">
<cfset fso_is_initialized = StructKeyExists(Application, "fso")>
</cflock>
<cfif not fso_is_initialized >
<cflock scope="Application" type="EXCLUSIVE" timeout="120">
<cfif NOT StructKeyExists(Application, "fso")>
<cfobject type="COM" action="create" class="Scripting.FileSystemObject" name="Application.fso" server="#serveur_en_cours#">
</cfif>
</cflock>
</cfif>
<!--- Get the drives collection and loop through it to populate the
structure. --->
<cfset drives=Application.fso.drives()>
<cfset driveSpace=StructNew()>
<cfloop collection="#drives#" item="curDrive">
<!--- A DriveType of 2 indicates a fixed disk --->
<cfif curDrive.DriveType IS 2>
<!--- Use dynamic array notation with the drive letter for the struct key
--->
<tr>
<td width="66" height="22" align="center" valign="middle" bgcolor="#FFFFFF"><span class="Style3"><cfoutput>#curDrive.DriveLetter#</cfoutput></span></td>
<td width="77" align="center" valign="middle" bgcolor="#FFFFFF"><span class="Style3"><cfoutput>#NumberFormat(curDrive.totalsize/1073741824,"99.99")#</cfoutput></span></td>
<td width="74" align="center" valign="middle" bgcolor="#FFFFFF"><span class="Style3"><cfoutput>#NumberFormat(curDrive.availablespace/1073741824,"99.99")#</cfoutput></span></td>
<td width="80" align="center" valign="middle" bgcolor="#FFFFFF"><span class="Style3"><cfoutput>#NumberFormat(curDrive.availablespace/curDrive.totalsize*100,"99.99")#%</cfoutput></span></td>
<td width="85" align="center" valign="middle" bgcolor="#FFFFFF"><span class="Style3">vert</span></td>
</tr>
</cfif>
</cfloop>
</cfloop>
</table>