Set up PowerShell Environment
NCache provides integration with Windows PowerShell to easily automate its administrative processes. Moreover, NCache remote tasks can also be managed over the network through a single machine using PowerShell cmdlets.
Prerequisites
NCache PowerShell Provider is only compatible with PowerShell version 4.0 and above.
For Windows Server 2016, make sure that the environment variable
PSModulePath
has been refreshed before using NCache PowerShell commands.
For more detail on Windows PowerShell please see the Microsoft Windows PowerShell section.
When to Run PowerShell as Administrator
You need to run PowerShell as Administrator while performing the following operations:
- Restarting NCache Service,
- Running any custom scripts which use NCache cmdlets.
Run Custom Scripts
If you wish to create and execute PowerShell scripts using cmdlets:
Search for Windows PowerShell and Run as Administrator
Set script execution policy to
RemoteSigned
to allow remote execution:
Set-ExecutionPolicy RemoteSigned
List NCache PowerShell Cmdlets
In order to get a list of all the supported functionalities of NCache for PowerShell, execute the following command on Windows PowerShell:
Get-Command –Module ncacheps
Get Help for PowerShell cmdlets
In order to get complete help for any particular cmdlet, execute the following command on Windows PowerShell.
Get-Help <CmdletName> –Full
Following example shows how to get complete help for Get-Caches
.
Get-Help Get-Caches –Full
Troubleshooting
Unable to Run NCache PowerShell Cmdlets
This occurs if the environment variable PSModulePath
has not been refreshed after the installation. Import the NCache PowerShell module (ncacheps.dll) found in the location %NCHOME%\bin\tools\ncacheps.
Execute the following command on Windows PowerShell to import the module:
Import-Module -Name ncacheps
In order to verify if the environment variable PSModulePath
has been refreshed successfully, run the following command using Command Prompt (Run as Administrator).
echo %PSModulePath%
On running the following command, the path for ncacheps gets displayed. If the output displays %NCHOME%\NCache\bin\tools it means that the environment variables are refreshed.