All,
I have made a powershell script to remotely install the log forwarder msi and import the cfg file, however the service will not stay running (it can be started but immediately stops). When I manually install the application the service functions properly. Does anyone have experience deploying the log forwarder in this manner? Any insight to what may be the issue is greatly appreciated, TIA.
Write-Host "Enter Corp Creds"
$corpcred = Get-Credential
#Write-Host "Enter Ops Creds"
#$opscred = Get-Credential
$corplist = Get-Content C:\scripts\corplog.txt #lists of systems
$opslist = Get-Content C:\scripts\opslog.txt
$file = '\\fileserverpath\sw_log.msi' #variables for files
$file2 = '\\fileserverpath\LogForwarderSettings.cfg'
foreach ($c in $corplist) { #for loop
$session = New-PSSession -ComputerName $c -Name RS -Credential $corpcred #start pssession with creds
Enter-PSSession -Name RS #enter session
Copy-Item -Path $file -ToSession $session -Destination 'C:\temp\' #copy msi to temp dir
Invoke-Command -Session $session -ScriptBlock {Start-Process "msiexec.exe" -ArgumentList "/i c:\temp\sw_log.msi /quiet" -Wait} #use msiexec to run msi with options
Copy-Item -Path $file2 -ToSession $session -Destination 'C:\Program Files (x86)\SolarWinds\SolarWinds Event Log Forwarder for Windows\' #copy cfg to app dir
Invoke-Command -Session $session -ComputerName $c -ScriptBlock {Start-Service -InputObject 'Log Forwarder for Windows'} #start service, this is a troubleshooting step, doesn't work
Remove-PSSession -Name RS #close pssession
}