Solved

Disk Quota Notifications (Using Script) Not Working

Posted on 2008-10-30
6
2,684 Views
Last Modified: 2013-12-02
I am pulling my hair out on this one.  I am trying to set up disk notifications using a simple .vbs script I have written that simply pops up a message box.  I cannot, for the life of me, figure out how to get this working within the quota template (in file system resource manager).  E-mail notification works fine, but I do not want to use that.

I need to know:

1 - What to put in the "Run this command or script" field
2 - What to put in the "Command arguments" field
3 - What to choose for the working directory
4 - What permissions to use on these folders
5 - Which command security option I should choose (I would rather go with most secure)

I found somewhere online that I should put "%windir%\system32\cscript.exe" in the "Run this command or script field, and "//nologo C:\Admin\nameofmyvbsscript.vbs" in the "Command arguments" field.  DOESN'T WORK.  What am I doing wrong?

All I want to do is have my vbs execute on the user's machine when they exceed the warning limit.  Seems easy, but no!  Thanks in advance for any help.
0
Comment
Question by:mtsi
  • 3
  • 3
6 Comments
 
LVL 31

Expert Comment

by:Henrik Johansson
Comment Utility
You nead to run the quota-notification on the file server instead of at the client workstation. Let the result of the script execute a 'net send' targetting the user.
0
 

Author Comment

by:mtsi
Comment Utility
Yes, I've tried that as well, and could not get it to work.  But that still doesn't answer the question.  Even if I wanted the script to do a net send, I can't get it to execute.  I've even tried a batch file and that doesn't work.  I need more details about how I can get the script to work (with any command).  The command is irrelevant at this point.  I just want the script to run.  Thanks.
0
 
LVL 31

Expert Comment

by:Henrik Johansson
Comment Utility
The below sample is a working quota configuration file.

Notification=C
RunLimitInterval=1
Command=C:\WINDOWS\SYSTEM32\cmd.exe
Arguments=/c C:\quota-notify.cmd [Source IO Owner] [Quota Path] [Quota Threshold] [Quota Limit]
LogResult=Enable
Account=LocalSystem
WorkingDirectory=c:\temp
MonitorCommand=Enable
KillTimeout=5
0
Integrate social media with email signatures

Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

 

Author Comment

by:mtsi
Comment Utility
Great, thanks for the response.  A few more questions:

1 - I have no idea what path the actual quota configuration file is located at.  I know where to edit some of those things within the GUI configurator, but not the file.  Please let me know.
2 - What are the contents of your "quota-notify.cmd" file in this example?
3 - Do I have to run it as LocalSystem?  I would rather avoid that if possible, and run it as LocalService instead.

Thanks again for your help.
0
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 500 total points
Comment Utility
1. The configuration file is just a textfile used for importing configuration with dirquota CLI-tool.
C:\>dirquota quota add /path:path-to-folder /add-notification:80,C,c:\quota-notify.cfg
C:\>dirquota quota modify /path:path-to-folder /modify-notification:80,C,c:\quota-notify.cfg

If you prefer GUI-based management, the management dialog should look like the attached printscreen.

2. Handle %~1 %~2 etc for each counted parameter (%1 works also, but will not handle "spaced argument" as a single argument). First line splits out USERNAME from  DOMAIN\USERNAME. The script is only logging to a text file, but can also use msg command (replaces 'net send') to send an alert.

for /F "delims=\ tokens=2" %%a in ("%~1") do set quotauser=%%a
echo %DATE% %TIME% %quotauser% passed %~2 percent of %~3 in %~4 >> c:\temp\quota-notify.txt

3. Yes, you shall be able to run it as LocalService instead of LocalSystem. I just used LocalSystem in a lab environment
quota-mgmt.jpg
0
 

Author Comment

by:mtsi
Comment Utility
Just for those that might be in the same boat...

I was never able to get the .cmd file working, although I'm sure it's possible.  Instead, I used a .vbs script to run a net send command.  Here were the commands I used in FSRM for the template I was setting up:

Run this command or script:

C:\Windows\System32\cscript.exe

Command arguments (note that [Source Io Owner] is very important cause the vbscript uses that to find the current user and send them a message):

//nologo "FULL PATH TO YOUR SCRIPT" [Source Io Owner] [Quota Limit MB] [Whatever other args you want from FSRM]

Working directory:

Same as FULL PATH TO YOUR SCRIPT, minus the script name and last backslash

Run the command as:

LocalService

Here are the contents are my .vbs script:

'*******************************

'Turn on error checking
On Error Resume Next

'Declare variables
Dim objShell
Dim strUser
Dim strLimitMB
Dim intSlashPos

'Get arguments that were passed to the script through File System Resource Manager.  
'You can modify this based on how many arguments you want to give the script in the
'"Command Arguments" field
strUser = WScript.Arguments.Item(0)
strLimitMB = WScript.Arguments.Item(1)

'Remove the "DOMAIN\" portion from the user name
intSlashPos = Instr (1, strUser, "\", vbTextCompare)
strUser = Mid (strUser, intSlashPos + 1, Len(strUser) - intSlashPos)

'Create the object
Set objShell = Wscript.CreateObject("WScript.Shell")

'Create the message to send - this relies on arguments that were passed
'from File System Resource Manager
strMessage = "Some message here.  For example, your folder has reached the limit of " & _
                       strLimitMB & " MB."

'Send the message to the user
objShell.Run "net send " & [strUser] & " " & [strMessage], True

WScript.Quit

******************

I hope this helps others, cause I know how frustrating this is...
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now