在远程计算机.NET openremotebasekey访问%APPDATA% [英] Access %appdata% on distant computer .NET openremotebasekey
问题描述
我试图访问用户的应用程序数据在远程计算机上。我需要的一切权利。我想这样的:
I am trying to access the "AppData" of a user on a remote computer. I have all the rights needed. I tried this:
r = RegistryKey.OpenRemoteBaseKey(RegistryHive.Users, MachineName)
r.OpenSubKey(SIDValue & "\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
AppData = r.GetValue("AppData")
事实上,它检索我自己的应用程序数据文件夹......遥远的计算机上的帐户实际上的SID值和我的是一样的(我是在一个域)。我不知道这是否就是为什么我让我自己的应用程序数据文件夹中的原因。
The fact is that it retrieves my own appdata folder...Actually the SID Value of the account on the distant computer and on mine is the same (I am under a domain). I don't know if it is the reason why I get my own appdata folder.
我该如何操作?
当我浏览HKEY_LOCAL_MACHINE,我管理浏览HKEY_USERS时有关于远程computer..But信息没有。
When I browse the HKEY_Local_Machine, I manage to have information about the remote computer..But not when browsing HKEY_USERS.
推荐答案
我发现自己的答案,谢谢... 对于那些有兴趣谁进如何做到这一点,这是我如何做的:
I found the answer myself, thanks... For those who are interested into how to do this, here is how I did:
通过HKLM浏览没给我好DATAS(在远程计算机上的那些),我只是关注SYSTEMROOT值是在HKLM \软件\微软\的Windows NT \ CURRENTVERSION。 检索应用程序数据是做到这一点的方法后:
As browsing through HKLM did give me the good datas (the ones on the remote computer), I just searched for the systemroot value which is in HKLM\Software\Microsoft\Windows NT\CurrentVersion. Retrieving the appdata is done that way after:
systemdrive = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, _
MachineName).OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion").GetValue("SystemRoot").ToString.Substring(0, 3)
那么,对于Windows XP:
Then, For Windows XP:
appdata = systemdrive & "Documents and Settings\" & username & "\Application Data"
有关Windows 7的:
For Windows 7:
appdata = systemdrive & "Users\" & username & "\AppData\Roaming"
这篇关于在远程计算机.NET openremotebasekey访问%APPDATA%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!