Getting Data In

Unable to log into $Splunk_Home on CMD or PowerShell (Beginner)

virggray
New Member

When trying to log into splunk to get to the @root for splunk it is not recognizing the path provided. In powershell I receive this error:

PS C:> $splunk_home=C:\Program Files\Splunk
C:\Program : The term 'C:\Program' 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:14
+ $splunk_home=C:\Program Files\Splunk
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Program:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
In windows(CMD) I receive this error:
C:\Program Files\Splunk\bin>splunk.exe envvars & setsplunkenv.bat
'setsplunkenv.bat' is not recognized as an internal or external command,
operable program or batch file.

If I am missing a step please let me know

Thanks

0 Karma

jhornsby_splunk
Splunk Employee
Splunk Employee

Hi @virggray,

For PowerShell, this should probably be:

 $env:SPLUNK_HOME="C:\Program Files\Splunk"

However this doesn't really achieve much (it just sets the environmental variable SPLUNK_HOME). It's unclear to me what exactly you're trying to do...are you able to clarify?

If you just want to be able to run the splunk CLI command from a PowerShell prompt, you need to do something like:

$env:PATH += ";" + "C:\Program Files\Splunk\bin"

Cheers,

- Jo.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Where to begin?

1) The command should not start with '$'. The '$' character is used for variable substitution in Linux shells. Use %splunk_home% in Windows.
2) Variable substitution rarely makes sense on the left side of =.
3) The correct variable name is SPLUNK_HOME (all upper case).
4) Windows path names containing spaces should be enclosed in quotation marks.
5) The full name of the program is splunk.exe.
6) One does not log in to Splunk from the command line, except to perform certain administrative commands. Log in to the GUI at port 8000 of the local system.
7) It is not necessary to login to Splunk to administer it. If a command requires authentication, it will request it. For non-interactive use, add the -auth username:password option to the command.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...