New Boundary Support Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Configuration Group scriptingExpand / Collapse
Author
Message
Posted 1/12/2004 3:28:00 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Advanced Members
Last Login: 1/21/2004 10:48:00 AM
Posts: 154, Visits: 1
I want to look at a specific folder on all machines and get the folder size. I want to see all the machines that have a folder size greater then 10mb.

Is there a way to do this?

Thanks

Post #213
Posted 1/12/2004 3:28:00 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2/12/2011 11:11:06 PM
Posts: 742, Visits: 1,211
Windows does not keep track of folder size like it does with file size. You'll notice that even in Windows Explorer, when you right click on a folder and view it's properties, the Size is calculated on the fly. This results in the fact that the Prism Deploy Client is unable to query the folder size for Configuration Group resolution. There is a possible workaround though.

You can assign a Visual Basic script that will calculate a specified folder's size and store that value in a local INI file. Then you can create a Configuration Group based on the INI file's value. Take the following VB script for example (saved as script.vbs):

Const foldername = "C:\Program Files\Prism Deploy\"
Dim objFSO, objFolder, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(foldername)
Set objFile = objFSO.CreateTextFile(foldername & "foldersize.ini", 2)
objFile.WriteLine "[Folder Size]"
objFile.WriteLine "Bytes=" & objFolder.Size
objFile.Close

This script will calculate the size of the "C:\Program Files\Prism Deploy" folder and then store this value in a file called foldersize.ini in the Prism Deploy folder. You can assign this script.vbs to all your machines as a command Task. Thus each machine will have an INI file created in the Prism Deploy folder that tells how big each machines Prism Deploy folder actually is.

The next step is to create a User-defined Configuration Group to query the INI file. Use the following rule as an example:

<INI Value> "C:\Program Files\Prism Deploy\foldersize.ini\\Folder Size\\Bytes" > 10485760

This Configuration Group will then populate with any computer that has an INI file named foldersize.ini in the C:\Program Files\Prism Deploy folder, and has a Bytes value of greater the 10485760.

This method will allow you to create Configuration Groups based on certain folder sizes of subscribed computers. A few things to note:

- Windows Script Host is available for Windows 95 and NT; it is preinstalled on 98 and 2000 and above

- Replace "C:\Program Files\Prism Deploy" in both the VB script and Configuration Group rule with the folder you are querying

- If the folder size changes, the foldersize.ini will not automatically reflect that change. The VB script would have to be run again, perhaps a recurring task...



New Boundary Technologies Support
support@newboundary.com

Post #214
Posted 2/2/2009 12:23:32 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2/12/2011 11:11:06 PM
Posts: 742, Visits: 1,211
Another customer wanted to use this technique to get the file size of secedit.sdb. Here's the modified vb script:

Const filename = "C:\Windows\Security\Database\secedit.sdb"
Dim objFSO, objFile, objINIFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(filename)
Set objINIFile = objFSO.CreateTextFile("C:\Program Files\New Boundary\Client\SeceditSize.ini", 2)
objINIFile.WriteLine "[FileSize]"
objINIFile.WriteLine "Bytes=" & objFile.Size
objINIFile.Close

Here are the steps:

  1. Save the text above with .vbs extension, then deploy the VB script through Prism using a Command Task. Here's the syntax of the Command Task (ignore line wrapping): cscript.exe \\server\share\SeceditSize.vbs
  2. Create a predefined configuration group by pasting in the following, instead of using one of the predefined drop-down choices: <INI Value> "c:\program filesew boundary\client\seceditsize.ini\\FileSize\\Bytes"




New Boundary Technologies Support
support@newboundary.com

Post #1739
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: New Boundary Support

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 12:51pm

Powered By InstantForum.NET v4.1.3 © 2012
Execution: 0.172. 9 queries. Compression Enabled.