I have written a script and i have put a condition that if server is pining search for below file and read the file content. but its giving error like below
if ((Test-Connection -ComputerName $fqdn -Count 1 -Quiet) -eq 1)
{
$Value = "Host is pinging"
$searchtext = "Imaging Completed"
$file = "\\$fqdn\C$\Image.log"
if (Test-Path $file)
{
if (Get-Content $file | Select-String $searchtext -quiet)
{
Write-Host "$fqdn Imaging Completed"
Error:
Test-Path : Access is denied
At C:\Windows\TEMP\hudson4530962683016292267.ps1:65 char:5
+ if (Test-Path $file)
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (\\server1.us.o...\Image.log:String) [Test-Path], UnauthorizedAccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.TestPathCommand
Can anyone correct me here to fix the issue?

\\server1.us.o...\Image.log.Test-Connection