cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dshephard
Engaged Sweeper
I need a report that shows all servers and all disks with 90% or less free disk space on each disk.

Can this be created as a widget?

Thanks as I'm new to Lansweeper.
1 REPLY 1
Andy_Sismey
Champion Sweeper III
Hi,

Have a read of this KB article - https://www.lansweeper.com/knowledgebase/how-to-create-custom-widgets/

I have written a very quick Widget for you based on the 10% disk space report , if you create a new widget "Server10Space.aspx" file in "\\server\c$\Program Files (x86)\Lansweeper\Website\WidgetsCustom" and paste the below query and save, then in Lansweeper in "Configuration" -> "Widgets" add the new widget with a Title and file "Server10Space.aspx", add the widget to your page and it "should" work


<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="LS.Enums" %>

<%@ Import Namespace="LS" %>

<% Response.CacheControl = "no-cache";%>

<% Response.AddHeader("Pragma", "no-cache"); %>

<% Response.Expires = -1; %>

<% LS.User.Current().CheckUserWebsiteAccess(); %>



<%var dsAssets = DB.ExecuteDataset("Select Top 1000000 tblAssets.AssetID, tblAssets.AssetName, tsysOS.OSname As OS, tblAssets.SP, Cast(tblDiskdrives.Freespace / 1024 / 1024 / 1024 As numeric) As FreeGB,Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) As TotalSizeGB, Ceiling(tblDiskdrives.Freespace / (Case tblDiskdrives.Size When 0 Then 1 Else tblDiskdrives.Size End) * 100) As [%SpaceLeft],tblDiskdrives.Lastchanged As LastChanged From tblAssets Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID Inner Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID Inner Join tblState On tblState.State = tblAssetCustom.State Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype Inner Join tsysIPLocations On tsysIPLocations.LocationID = tblAssets.LocationID Inner Join tblDomainroles On tblDomainroles.Domainrole = tblComputersystem.Domainrole Left Join tsysOS On tblAssets.OScode = tsysOS.OScode Where Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) <> 0 And Ceiling(tblDiskdrives.Freespace / (Case tblDiskdrives.Size When 0 Then 1 Else tblDiskdrives.Size End) * 100) < 10 And tblState.Statename = 'Active' And tblDomainroles.Domainrolename In ('Stand-alone server', 'Member server', 'Primary domain controller', 'Backup domain controller') And Case tblDiskdrives.DriveType When 3 Then 'Local Disk' End = 'Local Disk' Order By tblAssets.Domain, tblAssets.AssetName, tblDiskdrives.Caption");



if (dsAssets.Rows.Count != 0)

{%>

<table width="400" border="0" cellpadding="0" cellspacing="0">

<tr><td>Asset</td><td>Free GB</td><td>Total Size (GB)</td></tr>

<% foreach (DataRow myrow in dsAssets.Rows)

{%>

<tr>





<td align="left" ><a href="<%=ResolveUrl("~/")%>asset.aspx?AssetID=<%:myrow["AssetID"]%>"><%: myrow["AssetName"] %></a></td>

<td align="left" valign="top"><%: myrow["FreeGB"] %></td> <td align="left" valign="top"><%: myrow["TotalSizeGB"] %></td>



</tr>

<% }%>

</table>





<%if (LS.User.Current().IsInRole(Permission.EditConfiguration)){%><div style="float:right"><a href="<%=ResolveUrl("~/")%>configuration/AssetGroups/" class="sml">config</a></div><% } %>

</div>

<%}%>




Cheers
A