Hi
I am trying to replace content within in multiple files on each server across multiple servers. I can get it to work local (so multiple files on one server). When I try the same thing via UNC path it falls apart on me, can anyone please help? or is it not possible and it needs to be completed with Invoke-Command?
$Files = Get-ChildItem '\\server\i$\SecureInet\wwwroot\view' -Recurse -Depth 1 | Where-Object {$_.Name -eq 'web.config' -and $_.Directory -notlike '*Authentication*'} ForEach ($File in $Files) {(Get-Content $File | Forach { $_ -replace "OldValue","NewValue"}) | Set-Content $_ }