![]() |
PsExec - registry current user |
Post Reply
|
Page 12> |
| Author | |
axewater
Newbie
Joined: 19 September 2005 Location: Netherlands Online Status: Offline Posts: 6 |
Quote Reply
Topic: PsExec - registry current userPosted: 19 September 2005 at 10:06am |
|
Hi .. First of all .. love your tools, use a lot of them in various scripts. Is there any solution to this ? I have tried looking at psloggedon to find the currently logged on user, but if I want to do anything with it, I will need the SID code of the user, not the username since the HKEY_USERS subkeys are SIDs and not usernames. ANY help would be much appreciated ! Allan |
|
![]() |
|
axewater
Newbie
Joined: 19 September 2005 Location: Netherlands Online Status: Offline Posts: 6 |
Quote Reply
Posted: 26 September 2005 at 3:49am |
|
Doesn't anybody have an idea for this one ? |
|
![]() |
|
axewater
Newbie
Joined: 19 September 2005 Location: Netherlands Online Status: Offline Posts: 6 |
Quote Reply
Posted: 03 November 2005 at 9:08am |
|
please ... I'm still looking for an answer to this one ... anyone ? |
|
![]() |
|
scatter
Newbie
Joined: 06 November 2005 Online Status: Offline Posts: 1 |
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 |
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. |
|
![]() |
|
gyokuran
Newbie
Joined: 04 November 2005 Location: United Kingdom Online Status: Offline Posts: 30 |
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". |
|
![]() |
|
jwray239
Newbie
Joined: 07 November 2005 Online Status: Offline Posts: 5 |
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 |
|
![]() |
|
Madmekanic
Newbie
Joined: 07 November 2005 Location: United States Online Status: Offline Posts: 1 |
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
|
|
![]() |
|
Jherad
Newbie
Joined: 09 November 2005 Online Status: Offline Posts: 2 |
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...
|
|
![]() |
|
Jherad
Newbie
Joined: 09 November 2005 Online Status: Offline Posts: 2 |
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
|
|
![]() |
|
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 |