
我們有一個 Windows 10 管理主控台來掛載所有共用。管理控制台已加入 AD 網域。我們正在使用管理員中的文件瀏覽器。控制台設定使用者磁碟配額。在設定使用者磁碟配額之前,等待載入所有配額條目需要很長時間。那麼,有沒有任何腳本或命令列可以完成這項工作?
不幸的是,fsutil 公用程式僅適用於本機磁碟區。
答案1
# Check if Fsrm module is installed
if (-not (Get-Module -ListAvailable -Name Fsrm)) {
Write-Host "File Server Resource Manager module not installed. Please install it and run the script again."
return
}
# Import the File Server Resource Manager module
Import-Module Fsrm
# Specify the username and path to the folder you want to set quotas for
$username = "JohnDoe"
$folderPath = "C:\Users\$username\Documents"
# Set the quota limit (in bytes)
$quotaLimit = 500MB
# Create a new quota
New-FsrmQuota -Path $folderPath -UserName $username -Size $quotaLimit -Enforce
# Optionally, you can set an email notification for the user
Set-FsrmQuota -Path $folderPath -UserName $username -Notification $true -NotificationLimit $quotaLimit
如果您使用配額模板,則只需使用 PowerShell 指派模板即可
# Import the File Server Resource Manager module
Import-Module Fsrm
# Specify the username and path to the folder you want to set quotas for
$username = "JohnDoe"
$folderPath = "C:\Users\$username\Documents"
# Specify the name of the quota template
$quotaTemplateName = "StandardTemplate"
# Assign the quota template to the folder
Set-FsrmQuota -Path $folderPath -UserName $username -TemplateName $quotaTemplateName
我假設您使用 fsrm 進行配額。您無法對遠端磁碟機執行此操作,這需要在託管資料的檔案伺服器上完成。