title: How do I give a program access to search an entire Drive (C & D) to see if a certain file exists? [VB.NET]
body: <p><strong>Here's my full concept:</strong>
  I want to be able to search the entire ‪C:\ &amp; D:\ to see if a certain file exists on the drive - not edit/delete/create, I just want to know if it exists or not.</p>
  <p><strong>Example:</strong>
  I want to be able to scan the entire D:\ to see if &quot;Testing321.exe&quot; exists on the drive. The problem I have is I'm able to scan something like &quot;C:\Users\Dan\Desktop&quot; but I'm unable to scan &quot;C:&quot; because I'm given an error related to insufficient permissions even though I have given the program full administrator permissions in the Manifest.</p>
  <p><strong>Error:</strong></p>
  <blockquote>
  <p>Unhandled exception. System.UnauthorizedAccessException: Access to the
  path 'C:\Documents and Settings' is denied.    at
  System.IO.Enumeration.FileSystemEnumerator<code>1.CreateRelativeDirectoryHandle(ReadOnlySpan</code>1
  relativePath, String fullPath)    at
  System.IO.Enumeration.FileSystemEnumerator<code>1.MoveNext()    at System.Collections.Generic.LargeArrayBuilder</code>1.AddRange(IEnumerable<code>1 items)    at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable</code>1
  source)    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1
  source)    at System.IO.Directory.GetFiles(String path, String
  searchPattern, SearchOption searchOption)    at
  Alpha.Program.Main(String[] args) in
  C:\AlphaSS\Alpha\Alpha\Program.vb:line 80</p>
  </blockquote>
  <p><strong>Code:</strong></p>
  <pre><code>Dim Path As String
              Console.WriteLine(&quot;Enter Directory to search [Phantom DLL]: &quot;)
              Path = Console.ReadLine()
  
              Dim FolderPath = Path
              For Each filePath In Directory.GetFiles(FolderPath,
                                              &quot;RXEXV2.dll&quot;,
                                              SearchOption.AllDirectories)
  
                  If filePath IsNot Nothing Then
                      Console.WriteLine(&quot;DETECTED: Phantom Menu DLL Found: &quot; &amp; filePath)
                  Else
                      Console.WriteLine(&quot;Nothing Detected&quot;)
                  End If
  </code></pre>
  <p><em>This code above is essentially an idea I have in mind which will scan a player's computer for certain (cheat) files and if those files are found it will output it back to the console.</em></p>
  <p>If anyone has a solution to this, please let me know!</p>