-1

I'm trying to get the currently installed Mozilla Firefox Version remotely by a PsExec Powershell Script. I found following cmd commands which will show me the information I want to get:

$pathFirefox = "`"C:\Program Files (x86)\Mozilla Firefox`""
psexec \\$i -u $username -p $password cd $pathFirefox; firefox -v | more;

So it looks like he is sending both commands. The change directory and the firefox -v | more.

Unfortunately I get the error that "The term 'firefox' is not recognized as the name of a cmdlet..."

But excactly this code is working in a native windows cmd on the target pc. I am also checking the java version like that and its working fine. Maybe because of the simple "java -version" command.

I tried masking the command like "firefox -v | more"

It should give an output like this: Mozilla Firefox 67.0.4

DayDreaming
  • 99
  • 3
  • 10
  • Im now trying to execute only one command on the target computer (with quotes): << "C:\Program Files (x86)\Mozilla Firefox\firefox" -v | more >> But no matter how I am masking / escaping the path, it's keep trying to execute "C:\Program". It's not keeping the blank spaces in the path... – DayDreaming Jul 08 '19 at 08:18

2 Answers2

2

(New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Mozilla\Mozilla Firefox\CurrentVersion")

1

The following will return the version using Powershell:

$pathFirefox = 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
$ffversion = { [string](& 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe' -v| Write-Output) }

$Cred= Get-Credential

Invoke-Command -ComputerName 'TESTCOMPUTER' -ScriptBlock $ffversion -Credential $Cred

You might be able to wrap this into psexec if you can't use WinRM

Scepticalist
  • 3,737
  • 1
  • 13
  • 30