https://github.com/cyb3rward0g/poshgremlin
PowerShell module to expose Gremlin.NET
https://github.com/cyb3rward0g/poshgremlin
Last synced: 7 months ago
JSON representation
PowerShell module to expose Gremlin.NET
- Host: GitHub
- URL: https://github.com/cyb3rward0g/poshgremlin
- Owner: Cyb3rWard0g
- License: mit
- Created: 2021-09-29T07:37:06.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-23T05:57:13.000Z (over 3 years ago)
- Last Synced: 2025-03-21T01:34:28.639Z (7 months ago)
- Language: PowerShell
- Size: 15.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PoshGremlin
A PowerShell binary module (.dll) to expose Gremlin.NET via a PowerShell Cmdlet. This project uses [dnMerge](https://github.com/CCob/dnMerge), a lightweight .NET assembly dependency merger, to merge multiple .NET reference assemblies into a single DLL (PowerShell binary module).
## Installation
Copy and Paste the following command to install this package using PowerShellGet:
```PowerShell
Install-Module -Name PoshGremlin
```## Example: Gremlin and Azure CosmosDB
### Import Module
```PowerShell
Import-Module PoshGremlin
```### Define variables
```PowerShell
$hostname = "cosmos-ENDPOINT.gremlin.cosmos.azure.com"
$authKey = ConvertTo-SecureString -AsPlainText -Force -String 'COSMOSDB-KEY'
$database = "DBNAME"
$collection = 'GRAPHCOLLECTION'
$Credential = New-Object System.Management.Automation.PSCredential "/dbs/$database/colls/$collection", $authKey$gremlinParames = @{
Hostname = $hostname
Credential = $credential
}
```### Run Basic Gremlin query
```PowerShell
"g.V().has('label','directoryrole')" | Invoke-Gremlin @gremlinParams | convertTo-Json -Depth 10
```## Credits
* https://github.com/jasonchester/PSGremlin
* https://github.com/CCob/dnMerge
* https://github.com/apache/tinkerpop/tree/master/gremlin-dotnet## References
* https://docs.microsoft.com/en-us/powershell/scripting/developer/module/how-to-write-a-powershell-binary-module?view=powershell-7.2
* https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/cmdlet-overview?view=powershell-7.2
* https://docs.microsoft.com/en-us/samples/azure-samples/azure-cosmos-db-graph-gremlindotnet-getting-started/azure-cosmos-db-graph-gremlindotnet-getting-started/