Neo4j with Windows Powershell : xxxx is not a Neo4j Home directory - powershell

I've installed Neo4j (exe installer) and I've also extracted the powershell module from the zip file but now when I try to do anything I just get an error message like:
PS C:\dev\github\neo4j-sandbox\src\ps> Get-Neo4jServer c:\dev\github\neo4j-sandbox\neo4jdb
Get-Neo4jServer : c:\dev\github\neo4j-sandbox\neo4jdb is not a Neo4j Home directory
At line:1 char:1
+ Get-Neo4jServer c:\dev\github\neo4j-sandbox\neo4jdb
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-Neo4jServer
At first I thought perhaps I was misinterpreting what the neo4j "home directory" was and tried pointing it to the installation directory, but I just get the same error message.
PS C:\dev\github\neo4j-sandbox\src\ps> Get-Neo4jServer "c:\Program Files\Neo4j CE 2.3.2"
Get-Neo4jServer : c:\Program Files\Neo4j CE 2.3.2 is not a Neo4j Home directory
At line:1 char:1
+ Get-Neo4jServer "c:\Program Files\Neo4j CE 2.3.2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-Neo4jServer
So, what is the "Neo4j Home Directory" - I couldn't find a definition for that anywhere. Is it the data directory, or the installation directory, or something completely different.

It seems that somehow or another the installation via the exe download is different from the installation in the zip. I would have expected them to be the same, with the exe version just being automated.
Anyway, if you extract the zip file and copy the contents of the neo4j-community-2.3.2 (or appropriate for your version/edition) folder inside the zip file into a folder on your hard-drive, then point the PowerShell script at that folder it is happy to report the version of the installation.

Related

Running MongoDB, not recognizing mongod.exe or mongo.exe

I have been running MongoDB fine on my system, ran it 2 days ago. Now I am not able to access my file folders at all. When I type DIR, I see the files but when I try to access them through command line I get ObjectNotFound.
PS C:\Program Files\MongoDB\Server\4.2\bin> cd ./mongo.exe
cd : Cannot find path './mongo.exe' because it does not exist.
At line:1 char:1
+ cd ./mongo.exe
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./mongo.exe:String) [Set-
Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Chocolatey doesn't install

Following the steps to install Chocolatey via Powershell doesn't work on my Windows 7 64bit PC. I'm following https://chocolatey.org/install#install-from-powershell-v3
I have confirmed the ExecutionPolicy and that system path has
Powershell;
PS C:\Users\a> Get-ExecutionPolicy
AllSigned
PS C:\Users\a> ($env:Path).split(';')
%SystemRoot%\system32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files (x86)\Intel\iCLS Client\
C:\Program Files\Intel\iCLS Client\
C:\ProgramData\Oracle\Java\javapath
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\Java\jre1.8.0_40\bin
C:\Program Files\Java\jdk1.8.0_40\bin
C:\Program Files (x86)\AMD\ATI.ACE\Core-Static
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
C:\HashiCorp\Vagrant\bin
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Skype\Phone\
C:\Program Files (x86)\Git\bin
C:\Program Files (x86)\Git\libexec\git-core
C:\Program Files (x86)\Nmap
C:\Program Files\smartmontools\bin
Here are my error messages;
PS C:\Users\a> iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
???# : The term '???#' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ???# =====================================================================
+ ~~~~
+ CategoryInfo : ObjectNotFound: (???#:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.5.
!Test-Path : The term '!Test-Path' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:188 char:11
+ } elseif (!Test-Path $7zaExe) {
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (!Test-Path:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Extracting C:\Users\a\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\a\AppData\Local\Temp\chocolatey\chocInstall...
Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
At line:211 char:3
+ $process.Start() | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
Exception calling "BeginOutputReadLine" with "0" argument(s): "StandardOut has not been redirected or the process hasn't started yet."
At line:212 char:3
+ $process.BeginOutputReadLine()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
At line:213 char:3
+ $process.WaitForExit()
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install again. Error: 7-Zip signalled an unknown error (code )
At line:225 char:15
+ default { throw "$errorMessage 7-Zip signalled an unknown error (code $exitC ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to unzip...n error (code ):String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to unzip package using 7zip. Perhaps try setting $env:chocolateyUseWindowsCompression = 'true' and call install again. Error: 7-Zip signalled an unknown error (code )
I have tried the error messages suggestion on the last line
Perhaps try setting $env:chocolateyUseWindowsCompression = 'true'
But that only results in a whole series of other errors
PS C:\admin\scripts> iwr https://chocolatey.org/install.ps1 -UseBasicParsing
StatusCode : 200
StatusDescription : OK
Content : # =====================================================================
...
You're downloading a UTF-8-encoded file (the content begins with the characteristic UTF-8 byte order mark ), but it's being treated as ASCII text.
Besides:
I'm following https://chocolatey.org/install#install-from-powershell-v3.
No, you're not. The website you referenced tells you to use
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
which works as advertised, whereas you're trying to use
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
If you want to use that approach you need to remove the BOM from the content before piping it into Invoke-Expression:
(iwr https://chocolatey.org/install.ps1 -UseBasicParsing).Content -replace '^' | iex

Install MS Access DAO Primary Interop Assembly for Use with PowerShell Script

I am trying to automate Microsoft Access 2016 with PowerShell, but I appear to be missing an Office Primary Interop Assembly called Microsoft.Office.Interop.Access.Dao. I've tried a few approaches in PowerShell, and these are the errors that I get:
PS > $app.Application.OpenCurrentDatabase()
The following exception occurred while retrieving member "Application": "Could not load file or assembly 'Microsoft.Office.Interop.Access.Dao, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified."
At line:1 char:1
+ $app.Application.OpenCurrentDatabase()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMember
PS > Add-Type -Assembly "Microsoft.Office.Interop.Access.Dao"
Add-Type : Could not load file or assembly 'Microsoft.Office.Interop.Access.Dao, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
At line:1 char:1
+ Add-Type -Assembly "Microsoft.Office.Interop.Access.Dao"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.AddTypeCommand
Please note the difference in version (15.0.0.0 vs 12.0.0.0).
The only version of Office that I have installed on this machine is Office 2016 via Office 365 download. I have run gacutil /l from a Visual Studio Command Prompt, and I see that the other Office PIAs, version 15.0.0.0, are installed.
According to the NuGet Web site, I could download the assembly via NuGet Package Manager Console, if I were working on a Visual Studio Solution, but I cannot install the assembly with PowerShell:
PS > Install-Package Microsoft.Office.Interop.Access.Dao
Install-Package : No match was found for the specified search criteria and package name 'Microsoft.Office.Interop.Access.Dao'. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package Microsoft.Office.Interop.Access.Dao
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
My questions are:
How can I install Microsoft.Office.Interop.Access.Dao to the GAC
so I can reference it in PowerShell scripts?
If nuget.org is listed as a PackageSource in PowerShell, why can't I use the Install-Package command to install this assembly?
Why did this assembly not get installed with Office 2016/365?
The accepted answer will provide at least a solution to my first question - How can I install Microsoft.Office.Interop.Access.Dao to the GAC so I can reference it in PowerShell scripts?

"Could not find a part of the path" creating a service

I tried to create Azure cloud service using:
Create the Cloud Service
New-AzureServiceProject -ServiceName 'service-lift-and-shift' -Verbose
I am using Azure SDK 2.9 and it is giving the following error:
ServiceName: service-lift-and-shift
New-AzureServiceProject : Could not find a part of the path 'C:\Program Files (x86)\Microsoft
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\Resources\Scaffolding\General\scaffold.xml'.
At line:1 char:1
+ New-AzureServiceProject
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureServiceProject], DirectoryNotFoundException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding.NewAzureServiceProjectCommand
I solved this problem by copying folder
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Resources
to
C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile
Since you want create a Could Service which only exists in ASM mode, you should logged in with command: Add-AzureAccount.
I logged in with Add-AzureRmAccount in the first time and I got the same error as you. But when I logged in with Add-AzureAccount in ASM mode, it works.
So make sure you were logged in ASM mode.

Powershell command not working when run by octopus deploy

I have several steps to figure out this problem and I do't know what else to do. My end goal is to check my "app.exe" file version. when I run it on server manually both script versions work. But when Octopus runs both versions fail with different errors
Version 1:
$file = "C:\Octopus\Applications\AppStartUp\38.2.19.0\app.exe"
$fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($file).FileVersion
I get the error:
return [System.Diagnostics.FileVersionInfo]::GetVersionInfo <<<< ($file). FileVersion
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : DotNetMethodException
Version 2:
$file = "C:\Octopus\Applications\AppStartUp\38.2.19.0\app.exe"
(Get-Command "$file").FileVersionInfo.Fileversion
Error Message
Export-ModuleMember : The Export-ModuleMember cmdlet can only be called from in side a module. At C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\deployment\clickOnceLib.ps1:35 char:20
+ Export-ModuleMember <<<< -function * -alias *
+ CategoryInfo : PermissionDenied: (:) [Export-ModuleMember], InvalidOperationException
+ FullyQualifiedErrorId : Modules_CanOnlyExecuteExportModuleMemberInsideAModule,Microsoft.PowerShell.Commands.ExportModuleMemberCommand
Get-Command : The term 'C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\ESG.CSIS.StartUp.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\deployment\clickOnceLib.ps1:32 char:24
+ return (Get-Command <<<< "$file").FileVersionInfo.Fileversion
+ CategoryInfo : ObjectNotFound: (C:\Octopus\Appl...SIS.StartUp.exe:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Any Insite to these messages and why it happens only when running in octopus would be great.
It looks like your script can't access the file, or it doesn't exist. Check to make sure C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\ESG.CSIS.StartUp.exe exists and is accessible to the user the tentacle runs under (use windows effective permissions).
Also make sure it's there by the time the script runs, you haven't mentioned whether this is a seperate step, PreDeploy.ps1, Deploy.ps1 or PostDeploy.ps1 script