I have this simple line of code:
var entry = new DirectoryEntry("WinNT://DOMAIN/MachineName, Computer");
Console.WriteLine(entry.Guid);
In reality, the path is supplied by command line. This simple Console App is compiled for testing and in my tests I find that:
Unhandled Exception: System.IO.FileNotFoundException: The network path was not found.
at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() at System.DirectoryServices.DirectoryEntry.RefreshCache() at System.DirectoryServices.DirectoryEntry.FillCache(String propertyName) at System.DirectoryServices.DirectoryEntry.get_NativeGuid() at System.DirectoryServices.DirectoryEntry.get_Guid() at GetDirectoryEntryProperties.Program.Main(String[] args) in D:\GetDirectoryEntryProperties\Program.cs:line 15
Any ideas?
I am an administrator on all machines, however I did have another issue caused by a Device Lock service which caused an UnauthorizedAccessException
on interrogation, but in this case I can't even read the Guid of the machine.
Event Log is showing nothing of use.
Luke
I came across the same error message for a different situation. Perhaps the solution I found could help you too.
After upgrading to Windows 10, my computer gave a popup error when booting up that looked just like the one you posted. It was a FileNotFoundException at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo().
The solution was to copy two strings from one registry location to another.
Copy these strings: RegisteredOwner and RegisteredOrganization
From: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
To: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With