Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to execute a non powershell command with multiple arguments from within invoke-command

$
0
0

Hi there

I am running the below powershell code to execute a splunk command in order to reindex 1000's of exchange POP and IMap logs which were parsed incorrectly - and need the splunk indexer to "forget" whats indexed and reindex them with the proper parsing rules - i am not sure i am executing this properly within the Invoke-Command cmdlet with -argumentlist parameter? Could use some help here please?

$i=0
foreach($file in $files)
{
    Invoke-Command -ComputerName $env:computername -ScriptBlock{
                        $splunkpath = ' C:\Program Files\SplunkUniversalForwarder\bin\splunk.exe'
                        Start-Process -FilePath $splunkpath -ArgumentList 'cmd btprobe -d  $splunkpath/var/lib/splunk/fishbucket/splunk_private_db --file $Using:file --reset'
                        
                        
                        
                    } -Credential $admin
        $i++
        Write-Host "Value of i is $i"
}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>