The Neo4j PowerShell module allows administrators to:
- install, start and stop Neo4j Windows® Services
-
and start tools, such as
Neo4j Shell
andNeo4j Import
.
The PowerShell module is installed as part of the ZIP file distributions of Neo4j.
System Requirements
- Requires PowerShell v2.0 or above.
- Supported on either 32 or 64 bit operating systems.
Managing Neo4j on Windows
On Windows it is sometimes necessary to Unblock a downloaded zip file before you can import its contents as a module. If you right-click on the zip file and choose "Properties" you will get a dialog. Bottom-right on that dialog you will find an "Unblock" button. Click that. Then you should be able to import the module.
Running scripts has to be enabled on the system. This can for example be achieved by executing the following from an elevated PowerShell prompt:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
For more information see About execution policies.
The powershell module will display a warning if it detects that you do not have administrative rights.
How do I import the module?
The module file is located in the bin directory of your Neo4j installation, i.e. where you unzipped the downloaded file. For example, if Neo4j was installed in C:\Neo4j then the module would be imported like this:
Import-Module C:\Neo4j\bin\Neo4j-Management.psd1
This will add the module to the current session.
Once the module has been imported you can start an interactive console version of a Neo4j Server like this:
Invoke-Neo4j console
To stop the server, issue Ctrl-C
in the console window that was created by the command.
How do I get help about the module?
Once the module is imported you can query the available commands like this:
Get-Command -Module Neo4j-Management
The output should be similar to the following:
CommandType Name Version Source ----------- ---- ------- ------ Function Invoke-Neo4j 3.0.0 Neo4j-Management Function Invoke-Neo4jAdmin 3.0.0 Neo4j-Management Function Invoke-Neo4jBackup 3.0.0 Neo4j-Management Function Invoke-Neo4jImport 3.0.0 Neo4j-Management Function Invoke-Neo4jShell 3.0.0 Neo4j-Management
The module also supports the standard PowerShell help commands.
Get-Help Invoke-Neo4j
To see examples for a command, do like this:
Get-Help Invoke-Neo4j -examples
Example usage
-
List of available commands:
Invoke-Neo4j
-
Current status of the Neo4j service:
Invoke-Neo4j status
-
Install the service with verbose output:
Invoke-Neo4j install-service -Verbose
-
Available commands for administrative tasks:
Invoke-Neo4jAdmin
Common PowerShell parameters
The module commands support the common PowerShell parameter of Verbose
.