
Disponemos de una consola de administración de Windows 10 para montar todos los recursos compartidos. La consola de administración está unida a un dominio AD. Estamos usando el explorador de archivos en el administrador. consola para establecer la cuota de disco del usuario. Antes de establecer una cuota de disco de usuario, esperar a cargar todas las entradas de cuota lleva mucho tiempo. Entonces, ¿existe algún script o línea de comando que pueda hacer el trabajo?
Desafortunadamente, la utilidad fsutil es sólo para volúmenes locales.
Respuesta1
# 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
Si usa plantillas de cuota, puede simplemente asignar la plantilla con 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
Supuse que usabas fsrm para la cuota. No puede hacer esto para una unidad remota; debe hacerse en el servidor de archivos que aloja los datos.