Hello All,

I'm running into something I can't google my way out of. I'm using this line of code to retrieve the last logged on user of a system remotely:

Code Snippet

objRemoteRegistry = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, strComputer)

objResult = objRemoteRegistry.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI")

If objResult Is Nothing Then

'Something went wrong

Else

GetLastLoggedOnUser = objResult.GetValue("LastLoggedOnUser")

End If

The problem is this doesn't work on a remote Vista machine.

It works on local XP, remote XP, local Vista but not on remote Vista.

I'm getting this error:

Error Source: mscorlib

Error Message: The network path was not found

I get this error at the first line of code, the program doesn't even get to the second line.

The remote machine is reachable. My domain account is admin on that box, the program runs fine when I run it locally, the firewall is turned off, UAC is turned off, I can remotely connect to the registry with regedit without any problems.

My guess it's some kind of permission problem but I can't seem to find a solution.

How can I fix it/Is there another way to read a remote registry value on Vista?

Cheers, Michiel