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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...