title: How to remove Microsoft.PowerShell.Core\FileSystem::\\ from path
body: <p>i am comparing to folders with all their subfolders with powershell and its working fine on my local machine. but when i tried it on server its give me error and append</p>
  
  <pre><code>Microsoft.PowerShell.Core\FileSystem::\\
  </code></pre>
  
  <p>to all the files</p>
  
  <p>if any one have do such work earlier please help</p>
  
  <p>my script is </p>
  
  <pre><code>$Path = '\\Server1\Folder1'
  
  Get-ChildItem $Path -Recurse | ? { !$_.PSIsContainer } | % { 
          Add-Member -InputObject $_ -MemberType NoteProperty -Name RelativePath -Value $_.FullName.Substring($Path)
          $_
      }
  </code></pre>
  
  <p>and its give me error</p>
  
  <pre><code>Cannot convert argument "0", with value: "Microsoft.PowerShell.Core\FileSystem::\\Server1\Folder1\ServerListPowershell", for "Substring" to type "System.Int32": "Cannot convert value "M
  icrosoft.PowerShell.Core\FileSystem::\\Server1\Folder1\ServerListPowershell" to type "System.Int32". Error: "Input string was not in a correct format.""
  At C:\Users\cwr.satish.kumar\AppData\Local\Temp\898f72f1-a0d3-4003-b268-128c5efc9f2b.ps1:14 char:108
  +         Add-Member -InputObject $_ -MemberType NoteProperty -Name RelativePath -Value $_.FullName.Substring &lt;&lt;&lt;&lt; ($Path)
      + CategoryInfo          : NotSpecified: (:) [], MethodException
      + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
  </code></pre>
  
  <p>please help</p>