Solved

Disk Quota Notifications (Using Script) Not Working

Posted on 2008-10-30
6
2,824 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
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Shares and Excel files 2 31
Separate DNS forwarding 2 40
Blocking Microsoft Edge From Running? 14 52
Microsoft Security Compliance Manager 4.0 compare policy 4 30
Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
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…

679 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