![]() |
PsExec - registry current user |
Post Reply
|
Page 12> |
| Author | |
axewater
Newbie
Joined: 19 September 2005 Location: Netherlands Online Status: Offline Posts: 6 |
Post Options
Quote Reply
Topic: PsExec - registry current userPosted: 13 January 2006 at 6:37am |
|
wow .. I didn't check this thread anymore for some time, but it's got some whole new ideas in there now !!! great everyone thanks for your help, I will post what I did eventually after some testing and scripting. *************************************** when enumerating the user SID, I get a string that is a bit longer then the one in the registry : this is what is returned : S-1-5-21-510595209-1753942385-315576832-26444 but in the registry I only see :
So this doesn't match up. As for the method with REG LOAD and REG UNLOAD ... you can't load the NTUSER.DAT when the user is logged in ...the file is locked. So that didn't work out either I'm calling it a day and I'll try again on monday !! Edited by axewater |
|
![]() |
|
tim7ad
Newbie
Joined: 08 November 2005 Location: United States Online Status: Offline Posts: 13 |
Post Options
Quote Reply
Posted: 09 November 2005 at 1:13pm |
|
The best way to accomplish this is use reg load & unload. I’ve done this before several times, but don’t have time right now to go dig up the code. Essentially you’ll need to write a script or batch file that you execute remotely using psexec. The script will find the user’s ntuser.dat files that you need to modify. The script can use the REG load function. REG LOAD will load a user’s hive (ntuser.dat) into a key you specify. You can do this through the GUI to see what I’m talking about. 1. Open regedit. 2. Select the HKEY_Users key. 3. Select File, Load Hive 4. Browse to another profile on your system and find its ntuser.dat file, click Open 5. Give it a key name. (Any name will do. This is just an arbitrary key name that will be created to temporarily load the hive into.) 6. At this point you can see the user’s registry (what would be in HKCU when the user logs on) and make any changes you wish. *****NOTE**** There is no save option. When you unload the Hive it is saved. SO BE CAREFUL WHAT YOU CHANGE. J A script would do essentially the same thing Get a list of the ntuser.dat files with their paths by enumerating the “documents and settings” folder (assuming W2k or later and profiles are local). Use a For loop to go through each one of them Use REG LOAD to load the hive into a key Use REG EDIT to make your change Use REG UNLOAD to unload the key Move Next Works like a charm. The only dependency is having the REG command. In some cases I copy that to the machine with the script. If I have a chance to pull the actual code I’ll do so. Gotta run right now.
I hope this is helpful, Tim |
|
![]() |
|
Jherad
Newbie
Joined: 09 November 2005 Online Status: Offline Posts: 2 |
Post Options
Quote Reply
Posted: 09 November 2005 at 10:07am |
|
If you're using batch, something like... ... for /f "tokens=3" %%i in ('psloggedon -l \\remotecomputer ^|findstr /C:":"') do set myuser=%%i for /f "tokens=*" %%i in ('psgetsid \\remotecomputer %myuser% ^|findstr /C:"-"') do set mysid=%%i echo REGEDIT4 >myregfile.reg echo.>>myregfile.reg echo [HKEY_USERS\%mysid%\test]>>myregfile.reg echo "test"="test">>myregfile.reg echo.>>myregfile.reg copy myregfile.reg \\remotecomputer\c$ psexec \\remotecomputer regedit -s c:\myregfile.reg
...
Or something like that. I haven't tried it, but it looks right(ish). Test first
|
|
![]() |
|
Jherad
Newbie
Joined: 09 November 2005 Online Status: Offline Posts: 2 |
Post Options
Quote Reply
Posted: 09 November 2005 at 9:51am |
|
If you are pretty handy at scripting, you could use psloggedon to return the current logged on user, then psgetsid to convert the userid to a SID... THEN pipe the results to a reg file to copy to the machine for psexec...
|
|
![]() |
|
Madmekanic
Newbie
Joined: 07 November 2005 Location: United States Online Status: Offline Posts: 1 |
Post Options
Quote Reply
Posted: 07 November 2005 at 8:20pm |
|
Well I'd tell you what I did but the results weren't what I had intended good thing I backed up be for I made the attempt. Best of luck
|
|
|
Mad say You. Whom might you be to Judge
|
|
![]() |
|
jwray239
Newbie
Joined: 07 November 2005 Online Status: Offline Posts: 5 |
Post Options
Quote Reply
Posted: 07 November 2005 at 5:22pm |
|
Just as a follow-up and FYI You can't access the HKCU remotely.
Edited by jwray239 |
|
![]() |
|
gyokuran
Newbie
Joined: 04 November 2005 Location: United Kingdom Online Status: Offline Posts: 30 |
Post Options
Quote Reply
Posted: 07 November 2005 at 4:08am |
|
You could search the Active Directory for the user and retrieve his SID. The user's property in the AD is "objectSID". |
|
![]() |
|
axewater
Newbie
Joined: 19 September 2005 Location: Netherlands Online Status: Offline Posts: 6 |
Post Options
Quote Reply
Posted: 07 November 2005 at 3:10am |
|
Ah yes ... that would do the job ... If I use your method, there is still a logout / log back in involved ... nevertheless, I will use it since it seems the only option. |
|
![]() |
|
scatter
Newbie
Joined: 06 November 2005 Online Status: Offline Posts: 1 |
Post Options
Quote Reply
Posted: 06 November 2005 at 4:41am |
|
Well, i had the same problem and solved it by running a batch-fil from [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] which imported the registry file with keys pointing to 'current user', for every user that logged into the computer. After a couple of weeks I removed the entry from 'Run'. Not a very nice solution, but it worked.
|
|
![]() |
|
axewater
Newbie
Joined: 19 September 2005 Location: Netherlands Online Status: Offline Posts: 6 |
Post Options
Quote Reply
Posted: 03 November 2005 at 9:08am |
|
please ... I'm still looking for an answer to this one ... anyone ? |
|
![]() |
|
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |