Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 Set objFS = CreateObject("Scripting.FileSystemObject") Set objNewFile = objFS.CreateTextFile("NASVolumeUsage.htm") On Error Resume Next a = "<style>" a = a& "BODY{background-color:Lavender ;}" a = a& "TABLE{font-size: 10pt; font-family: arial;}" a = a& "TH{background-color: buttonface; font-decoration: bold;}" a = a& "</style>" objNewFile.WriteLine "<html>" objNewFile.WriteLine "<head>" objNewFile.WriteLine "<title>NAS Volume Usage Information</title>" objNewFile.WriteLine a & "</head><body>" objNewFile.WriteLine "<h2>NAS Volume Usage Information -- Date: " _ & Now() & "</h2>" objNewFile.WriteLine "<table BORDER=""1"">" objNewFile.WriteLine "<tr><th>NAS Volume Name</th><th>DFS Share Name</th><th>Total</th><th>Free</th></tr>" Dim result , machine , drvletter , netpath , dompath Dim objNetwork , objDrive , objFSO Const Decimals = 2 netpath = "\\nas1\vol1" dompath = "\\domain1\dfs1" Set objNetwork = CreateObject("WScript.Network") Set objFSO = CreateObject("Scripting.FileSystemObject") objNetwork.MapNetworkDrive "y:", netpath Set objDrive = objFSO.Drives("y:\") Total = FormatNumber(objDrive.TotalSize /1073741824, Decimals) Free = FormatNumber(objDrive.FreeSpace /1073741824, Decimals) objNewFile.WriteLine "<tr><td> " & netpath & " </td><td> " & dompath & "</td><td> " & Total & "</td><td> " & Free & "</td></tr>" objNetwork.RemoveNetworkDrive "y:" objNewFile.WriteLine "</table>" objNewFile.WriteLine "<br />" objNewFile.WriteLine "</body>" objNewFile.WriteLine "</html>" objNewFile.Close wscript.quit
Select allOpen in new window
Open in new window