Set-CacheServerPublicIP
This PowerShell cmdlet sets a public IPv4 address for a cache server within an NCache cluster. It is used when client applications cannot connect to cache servers using private IP addresses and must communicate over a public network. The cmdlet updates the cache server's public IP mapping in the NCache service configuration.
Note
This cmdlet sets the public IP using the <add key="NCacheServer.PublicIP" value=""/> tag in the service config file at %NCHOME%\bin\service\Alachisoft.NCache.Service.dll.config in Windows.
Set-CacheServerPublicIP -PublicIP [-Server] `
[-Credentials] [-Port] `
[-TlsCertPath] [-TlsCertPassword] `
[-NoLogo]
Examples
- This command sets the public IPv4 address 20.200.20.11 for the cache server 192.168.1.10 (private IP).
Set-CacheServerPublicIP -Server 192.168.1.10 -PublicIP 20.200.20.11
- This command sets the public IPv4 address 20.200.20.12 for the cache server 192.168.1.20 (private IP), using credentials for authentication.
Set-CacheServerPublicIP -Server 192.168.1.20 -PublicIP 20.200.20.12 `
-Credentials(Get-Credential john_smith)
- This command sets the public IP address of the cache server 192.168.1.10 to 20.200.20.12 using mutual TLS (mTLS). It runs from a machine where NCache is not installed and uses
C:\certs\client.pemto authenticate the machine running the cmdlet. The-TlsCertPasswordparameter decrypts the certificate’s password-protected private key. Omit this parameter if the private key is not encrypted.
Set-CacheServerPublicIP -Server 192.168.1.10 -PublicIP 20.200.20.12 `
-TlsCertPath "C:\certs\client.pem" -TlsCertPassword "clientKeyPassword"
- This command sets the public IPv4 address 20.200.20.12 for the cache server 192.168.1.30 (private IP), while suppressing the logo banner output.
Set-CacheServerPublicIP -Server 192.168.1.30 -PublicIP 20.200.20.12 -NoLogo
Properties
Note
The parameters with asterisk (*) on their names are the required parameters and the rest are optional.
| Parameters | Data Types | Description | Default Value |
|---|---|---|---|
-PublicIP* |
<String> |
Specifies the public IPv4 address to assign to the cache server. Only IPv4 addresses are supported. | - |
-Server |
<String> |
Specifies the private IP address of the cache server where the public IP should be set. | IP of local machine |
-Credentials |
<pscredential> |
Specifies credentials for authentication when setting the public IP on a remote cache server. | - |
-Port |
<Integer> |
Specifies the server port where the NCache Service is listening. | 9803 |
-NoLogo |
<SwitchParameter> |
Suppresses the display of the logo banner when executing the command. | False |
-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. |
- |