Solved

Disk Quota Notifications (Using Script) Not Working

Posted on 2008-10-30
6
2,857 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 31

Expert Comment

by:Henrik Johansson
ID: 22857623
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
ID: 22867362
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
ID: 22881755
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:mtsi
ID: 22890192
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
ID: 22896087
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
ID: 22932028
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exchange 2010 mailbox move 7 66
SSIS Paramater on start 2 54
Recover from a ISCSI Share In Windows 2 64
Server 2008 R2 has no more space on C: (OS) drive 21 82
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

738 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