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

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

Related

Installing CCM client on PC via powershell

I'm trying to speed up how soon SCCM recognises a device on the domain and starts the process of installing applications.
I have the below in powershell
$CCMInstallerPath = "\\ServerFQDN\SMS_MAN\Client\ccmsetup.exe"
$args = "/mp:MPServer", "/LOGON", "/UsePKICert", "SMSSLP=SMSSLPServer", "SMSSITECODE=MAN"
& $CCMInstallerPath $args
I get the below error:
Program 'ccmsetup.exe' failed to run: Access is deniedAt line:1 char:5
+ & $CCMInstallerPath $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:5
+ & $CCMInstallerPath $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
I have read and execute access to this file, both by group and directly by name
I have also tried:
Start-Process -FilePath \\ServerFQDN\SMS_MAN\Client\ccmsetup.exe -ArgumentList "/mp:MPServer", "/logon SMSSITECODE-MAN", "/UsePKICert"
and get the error
Start-Process : This command cannot be run due to the error: Access is denied.
At line:1 char:5
+ Start-Process -FilePath \\ServerFQDN\SMS_MAN\Client\c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
ServerFQDN is a replacement for one of our NM servers
I can fully connect to the folder and run the exe manually
I am running elevated powershell
Issue was caused by incorrect share permissions found in effective access.
Permission was granted to run the file but effective access was showing differences

GCloud powershell commands throw error but works fine in cmd

When I run GCloud comannds via windows cmd prompt it works.
But when I run them via powershell it throws an error in red, but the command gets completed successfully.
Eg:
1) Auth
gcloud auth activate-service-account xxx#xxx-xxx.iam.gserviceaccount.com --key-file=C:\xxxxx\cred.json
Error:
python.exe : Activated service account credentials for: [xxxx#xxxx.iam.gserviceaccount.com]
At xxxxxxxxxxxx\gcloud.ps1:117 char:3
+ & "$cloudsdk_python" $run_args_array
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Activated servi...iceaccount.com]:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
2) Upload file to storage bucket
gsutil cp $outputFile gs://bucketxxx
Error:
gsutil : Copying file://N:\out\sqlserver\tag.csv [Content-Type=application/vnd.ms-excel]...
At xxxxxxx\RDS_SQLServer_ExportData_DataWarehouse.ps1:38 char:5
+ gsutil cp $outputFile gs://bucketxxx | out-null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Copying file://...nd.ms-excel]...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
/ [0 files][ 0.0 B/ 2.8 MiB]
/ [1 files][ 2.8 MiB/ 2.8 MiB]
Operation completed over 1 objects/2.8 MiB.
I was not able comment, hence adding my inputs here.
First : The issue only seems to occur when this is run via Powershell ISE and not when executed via powershell prompt.
Second : This is not as such an error, for example when you see your own error you find the text after Not Specified as "Activated servi..." which means the action is sucessfully performed. Hope this helps to someone else stumbeling over here
python.exe : Activated service account credentials for: [xxxx#xxxx.iam.gserviceaccount.com]
At xxxxxxxxxxxx\gcloud.ps1:117 char:3
+ & "$cloudsdk_python" $run_args_array
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Activated servi...iceaccount.com]:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

Remove Git Hub related files

I am learning Git Hub. So I am a newbie.
Trying to remove git related files in project directory. I used this line:
rd .git /S/Q
However it gives me this error when I use VS Code:
Remove-Item : A positional parameter cannot be found that accepts argument '/q'.
At line:1 char:1
+ rd /s /q .git
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
and when I use CMD - command promt it gives me this error:
.git\refs\remotes - The directory is not empty.
What is going on.
This is where I get my information about this:
From stackoverflow
From YouTube
I am using Windows 10 btw.
EDIT:
I tried:
rd /S /Q .git
and I get error:
Remove-Item : A positional parameter cannot be found that accepts argument '/Q'.
At line:1 char:1
+ rd /S /Q .git
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
Tried:
rd /S/Q .git
Error:
Remove-Item : A positional parameter cannot be found that accepts argument '.git'.
At line:1 char:1
+ rd /S/Q .git
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
However I tried in command promt:
rd /S /Q .git
And I get :
.git\refs\remotes - The directory is not empty.
I try it second time right after that and it works...
So what am I missing here?
EDIT 2:
All of these comands work in command promt but only if I type them for the second time. Including the command - rd .git /S/Q.
The first time I get :
.git\refs\remotes - The directory is not empty.
and if I type it for the second time it works.
In VS Code it is not working no matter how many times I type them.

Merge 3 partial files with PowerShell Copy

I have 3 partial files that I need to merge to just 1 zip.
When using this PowerShell script:
copy /b v9_setup.1 + v9_setup.2 + v9_setup.3 v9_setup.zip
I get this error:
Copy-Item : A positional parameter cannot be found that accepts argument
'v9_setup.2'.
At line:1 char:1
+ copy /b v9_setup.1 v9_setup.2 v9_setup.3 v9_setup.zip
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Copy-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
I am using Windows 10 Pro.
As LotPings and user1287678 says, running the script in cmd.exe works. Thanks.

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

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.