title: Check if user has Read/Write permissions
body: <p>I'm given the user domain\name, password and the path and I want to show if given user has write or/and read access in given directory.</p>
  
  <p>General idea:</p>
  
  <pre><code>function Has-Read-Access {
      param(
          [Parameter(Mandatory=$true)][string]$userLogin
          [Parameter(Mandatory=$true)][string]$userPwd
          [Parameter(Mandatory=$true)][string]$directory
      )
      $hasReadAccess = 0
      #insert magic here
      return $hasReadAccess
  }
  
  Has-Read-Access -userLogin 'DOMAIN\user' -userPwd 'Passw0rd' -directory 'C:\FolderName\'
  </code></pre>
  
  <p>I have tried running the <code>powershell.exe</code> by a different user:</p>
  
  <pre><code>Start-Process powershell.exe -Credential "TestDomain\Me"
  </code></pre>
  
  <p>But it seems like a wrong approach.</p>