0

I know there are already some threads on this, but i dont get it...

ive got a list of file locations from a sql and extract them:

$results = --SQL QUERY--
$result = $results | select Dateipfad, Pfad, Datei, etc...
$dateipfad = $result | select Dateipfad
$dateipfad
Dateipfad
\\fs-srv01\folder1\folder2\file1.pdf
\\fs-srv01\folder1\folder2\file2.pdf
\\fs-srv01\folder1\folder2\file3.pdf
\\fs-srv01\folder1\folder2\file4.pdf

and when testing with Test-Path -Path $Dateipfad i get:

False
False
False
False

but when i use Test-Path -Path '\\fs-srv01\folder1\folder2\file4.pdf' its always true

BM-SMS
  • 13
  • 3
  • Please try to create a full [mcve] including how you assign the paths to `$Dateipfad` (not only for us but also for yourself to understand the problem you're facing) – iRon Oct 04 '22 at 06:52
  • [`$dateipfad = $result | select-object -ExpandProperty Dateipfad`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-object) – iRon Oct 04 '22 at 07:07

1 Answers1

0

alright i fixed it by using Test-Path -Path ('filesystem::'+$_.dateipfad)

and adding filesystem:: to the path

BM-SMS
  • 13
  • 3