Set-NCServiceConfigSetting
The Set-NCServiceConfigSetting cmdlet is used to add or update a key-value pair in the Alachisoft.NCache.Service.dll.config file on NCache servers. If the configuration change is hot-applicable, it will be applied immediately without requiring a service restart.
Set-NCServiceConfigSetting -Key -Value `
[-Server] [-TlsCertPath] `
[-TlsCertPassword] [-Credentials]
Examples
- This command sets the
NCacheServer.EventBulkCountkey-value pair in the Alachisoft.NCache.Service.dll.config file as per your requirement.
Set-NCServiceConfigSetting -Key NCacheServer.EventBulkCount -Value 50
- This command sets the
NCacheServer.EnableCacheLastAccessCountkey-value pair in the Alachisoft.NCache.Service.dll.config file on the server 20.200.20.11.
Set-NCServiceConfigSetting -Key NCacheServer.EnableCacheLastAccessCount `
-Value false -Server 20.200.20.11
- This command sets the
NCacheServer.EnableCommandThresholdLoggingkey-value pair in the Alachisoft.NCache.Service.dll.config file as per your requirement.
Set-NCServiceConfigSetting -Key NCacheServer.EnableCommandThresholdLogging -Value false
- This command sets NCacheServer.EnableCacheLastAccessCount to false in the NCache Service configuration on the specified server with mutual TLS (mTLS) enabled. It runs from a machine where NCache is not installed and uses C:\certs\client.pem to authenticate the machine running the cmdlet. The -TlsCertPassword parameter decrypts the certificate’s password-protected private key. Omit this parameter if the private key is not encrypted.
Set-NCServiceConfigSetting -Key NCacheServer.EnableCacheLastAccessCount -Value false `
-Server 20.200.20.11 -TlsCertPath "C:\certs\client.pem" `
-TlsCertPassword "clientKeyPassword"
- This command sets the
NCacheServer.EnableCommandThresholdLoggingkey-value pair in the Alachisoft.NCache.Service.dll.config file as per your requirement, using security credentials.
Set-NCServiceConfigSetting -Key NCacheServer.EnableCommandThresholdLogging `
-Value false -Credentials(Get-Credential john_smith)
Properties
Note
The parameters with asterisk (*) on their names are the required parameters and the rest are optional.
| Parameters | Data Types | Description | Default Value |
|---|---|---|---|
-Server |
<String> |
Specifies one or more IP addresses of NCache server(s) where the configuration change should be applied. NOTE: For multiple servers, provide comma-separated IP addresses inside double quotes. |
IP of local machine |
-Credentials |
<pscredential> |
Specifies the user credentials used to authorize the user for this operation. It is required in case security is enabled on cache server. The password must be the same as the active directory user password. The user id must be the same as the active directory user id. | - |
-Key* |
<String> |
Specifies the key to be added or updated in the Alachisoft.NCache.Service.dll.config file. | - |
-TlsCertPath |
<string> |
Specifies the path to the client PEM certificate used to authenticate this cmdlet when the target NCache server requires Mutual TLS. This parameter is required for Mutual TLS connections even when the cmdlet runs on an NCache server. The PEM file must contain the private key, leaf certificate, and any intermediate certificates. Relative paths are resolved against the current PowerShell location, and the file must exist. You can generate a client certificate using New-NCacheTlsCertificate. | - |
-TlsCertPassword |
<string> |
Password used to load the encrypted private key in the PEM file specified by -TlsCertPath. Required only when the private key is password-protected. Not needed for an unencrypted private key. The password is used only to load the client certificate for the current command's connections. It is not saved in the NCache server configuration. |
- |
-Value* |
<String> |
Specifies the value to associate with the specified key. | - |