Hi, configuration file for Log Insight Agent product (liagent.ini) contains a line:
hostname=OldServerName.domainname.local
I want to modify it with new server name remotely with:
Invoke-Command -ComputerName $servers -ScriptBlock {
(Get-Content -Path ‘C:\ProgramData\VMware\Log Insight Agent\liagent.ini’) -replace “(?<=^hostname=).*”,“NewServerName.domainname.local” | Set-Content -Path ‘C:\ProgramData\VMware\Log Insight Agent\liagent.ini’ -Force
}
However as end result I got empty liagent.ini file. Doing this locally works fine. Any help would be appreciated.