You can use quotas to protect the local computer and the remote computer from excessive resource use, both accidental and malicious. The following quotas are available in the basic configuration.
- The WSMan drive (WSMan:) provides several
quota settings, such as the MaxEnvelopeSizeKB and
MaxProviderRequests settings in the
WSMan:\<ComputerName> node, and the
MaxConcurrentOperations,
MaxConcurrentOperationsPerUser, and MaxConnections
settings in the WSMan:\<ComputerName>\Service node. For
information about the quota settings in the WSMan: drive, see
WSMan
Provider.
- You can protect the local computer by using
the MaximumReceivedDataSizePerCommandMB and
MaximumReceivedObjectSizeMB parameters of the New-PSSessionOption
cmdlet and the $PSSessionOption preference variable.
- You can protect the remote computer by adding
restrictions to the session configurations, such as by using the
MaximumReceivedDataSizePerCommandMB and
MaximumReceivedObjectSizeMB parameters of the Register-PSSessionConfiguration
and Set-PSSessionConfiguration
cmdlets.
When a command exceeds a quota, Windows PowerShell generates an error message. For example, the following error message indicates that a command exceeded the MaximumReceivedDataSizePerCommandMB quota.
Copy Code | |
---|---|
ERROR: The total data received from the remote client exceeded allowed maximum. |
To resolve the error, change the remote command to comply with the quota. Or, determine the source of the quota, and then increase the quota to allow the command to complete.
To change a quota value
-
Use the Set-Item cmdlet in the WSMan: drive or the New-PSSessionOption, Register-PSSessionConfiguration or Set-PSSessionConfiguration cmdlets to change a quota value.
For example, the following command increases the object size quota in the Microsoft.PowerShell session configuration on the local computer from 10 MB (the default value) to 11 MB. The Force parameter suppresses all user prompts and restarts the WinRM service without prompting.
Copy Code Set-PSSessionConfiguration -name microsoft.powershell -MaximumReceivedObjectSizeMB 11 -Force
The following command increases the value of MaxEnvelopeSizeKB on the local computer from 150 KB (the default value) to 200 KB.
Copy Code set-item wsman:\localhost\MaxEnvelopeSizeKB -value 200