Sysinternals Homepage
Forum Home Forum Home > Sysinternals Utilities > PsTools
  New Posts New Posts RSS Feed: PsExec - registry current user
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

PsExec - registry current user

 Post Reply Post Reply Page  12>
Author
Message
  Topic Search Topic Search  Topic Options Topic Options
axewater View Drop Down
Newbie
Newbie
Avatar

Joined: 19 September 2005
Location: Netherlands
Online Status: Offline
Posts: 6
  Quote axewater Quote  Post ReplyReply Direct Link To This Post Topic: PsExec - registry current user
    Posted: 19 September 2005 at 10:06am

Hi ..

First of all .. love your tools, use a lot of them in various scripts.
I often run into cases where I want to change some registry entries on a users PC, and I'd prefer to do it via psexec so I can script it. However, since the psexec session works under MY user account or the SYSTEM account, when I import a registry file with keys pointing to 'current user', this will not import to the currently logged on user.

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

Back to Top
axewater View Drop Down
Newbie
Newbie
Avatar

Joined: 19 September 2005
Location: Netherlands
Online Status: Offline
Posts: 6
  Quote axewater Quote  Post ReplyReply Direct Link To This Post Posted: 26 September 2005 at 3:49am

Doesn't anybody have an idea for this one ?

Back to Top
axewater View Drop Down
Newbie
Newbie
Avatar

Joined: 19 September 2005
Location: Netherlands
Online Status: Offline
Posts: 6
  Quote axewater Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2005 at 9:08am

please ... I'm still looking for an answer to this one ...

anyone ?

Back to Top
scatter View Drop Down
Newbie
Newbie


Joined: 06 November 2005
Online Status: Offline
Posts: 1
  Quote scatter Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
axewater View Drop Down
Newbie
Newbie
Avatar

Joined: 19 September 2005
Location: Netherlands
Online Status: Offline
Posts: 6
  Quote axewater Quote  Post ReplyReply Direct Link To This Post Posted: 07 November 2005 at 3:10am

Ah yes ... that would do the job ...
However .. the scripts I write are to solve problems on workstations here, I would run a script that changes some settings or installs some software. This would be instead of : remote control to the users pc, close all apps, log out user, log in myself, apply fixes / install software, log out, log user back in ... now I just call a script with the click of a button, and the problem is fixed in a few seconds...

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.

Back to Top
gyokuran View Drop Down
Newbie
Newbie
Avatar

Joined: 04 November 2005
Location: United Kingdom
Online Status: Offline
Posts: 30
  Quote gyokuran Quote  Post ReplyReply Direct Link To This Post 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".

Back to Top
jwray239 View Drop Down
Newbie
Newbie


Joined: 07 November 2005
Online Status: Offline
Posts: 5
  Quote jwray239 Quote  Post ReplyReply Direct Link To This Post Posted: 07 November 2005 at 5:22pm

Just as a follow-up and FYI

You can't access the HKCU remotely.

 



Edited by jwray239
Back to Top
Madmekanic View Drop Down
Newbie
Newbie
Avatar

Joined: 07 November 2005
Location: United States
Online Status: Offline
Posts: 1
  Quote Madmekanic Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Jherad View Drop Down
Newbie
Newbie


Joined: 09 November 2005
Online Status: Offline
Posts: 2
  Quote Jherad Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
Jherad View Drop Down
Newbie
Newbie


Joined: 09 November 2005
Online Status: Offline
Posts: 2
  Quote Jherad Quote  Post ReplyReply Direct Link To This Post 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

 

Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Privacy Statement