拡張子VBSで保存してください。
-----------------------
const scriptName = "fsrmReportLimit"
DIM limitNameslimitNames = Array("MaxFiles", "MaxFileGroups", "MaxFileOwners", "MaxFilesPerFileGroup", "MaxFilesPerFileOwner", "MaxFilesPerDuplGroup", "MaxDuplicateGroups", "MaxQuotas", "MaxFileScreenEvents", "MaxPropertyValues", "MaxFilesPerPropertyValue")
const optLimit = "/limit"const optValue = "/value"
DIM objArgs, fsrm, strLimitName, strLimitValue
set objArgs = wscript.Arguments if objArgs.count = 0 then PrintUsage() wscript.quitend if
if objArgs.count = 1 then if objArgs(0) = "/?" then PrintUsage() wscript.quit end ifend if
DIM i, jDIM strOption, strNewOptionDIM nModifyPropertiesnModifyProperties = 0for i = 0 to objArgs.count-1 if (LCase(objArgs(i)) = optLimit) then strLimitName = objArgs(i+1) i = i + 1 elseif (LCase(objArgs(i)) = optValue) then strLimitValue = objArgs(i+1) i = i + 1 else wscript.echo "Error: invalid argument, " & objArgs(i) PrintUsage() wscript.quit end ifnext
DIM limitNameCodelimitNameCode = -1for i = LBound(limitNames) to UBound(limitNames) if (LCase(strLimitName) = LCase(limitNames(i))) then limitNameCode = i + 1 exit for end ifnext
if (limitNameCode = -1) then wscript.echo "Error: invalid limit name, " & strLimitName PrintUsage() wscript.quitend if
set fsrm = WScript.createobject("fsrm.FsrmReportManager")
DIM newLimit
wscript.echo strLimitName & " = " & fsrm.GetReportSizeLimit(limitNameCode)
If trim(strLimitValue) = "" then Wscript.Quit
call fsrm.SetReportSizeLimit(limitNameCode, strLimitValue)newLimit = fsrm.GetReportSizeLimit(limitNameCode)
if (Int(newLimit) = Int(strLimitValue)) then wscript.echo "Report size limit " & limitNames(limitNameCode - 1) & " was changed to " & strLimitValueelse wscript.echo "unable to change limit " & limitNames(limitNameCode - 1) & ". Limit is set to " & newLimitend if
function PrintUsage()wscript.echo ""wscript.echo scriptName & " /limit <name> [/value <value>]"wscript.echo " <name> - name of the report size limit to modify"wscript.echo " <value> - new value for the size limit"wscript.echo ""wscript.echo "Report limit values:"for i = LBound(limitNames) to UBound(limitNames) wscript.echo " " & limitNames(i)nextend function
FSRM はご存知でしょうか? ファイル サーバー リソース マネージャ です。Windows Server 2003 R2 から実装された機能で、ディレクトリレベルのクオーター管理機能やファイルスクリーン機能などが実装されています。無償で使えるすごく便利な機能なのですが、案外知られていないんですねぇ。