Arthur L Posted February 1, 2007 Share Posted February 1, 2007 Hello Guys,I need to deploy a script to change printer settings to default values (like default monochrome and duplex printing). The script runs fine when executed on the local machine. But when I use our deployment console to remotely run the script on the end-users workstation, the .reg settings do not take effect on the logged-in user. I suspect that the script loads the .reg settings into the administrator account and not on the currently logged-in user.I have been seeing the @username function but don't know how to implement it to load a .reg file. I'm sure experts here can code this in less than 5minutes pls help. thanks... Link to comment Share on other sites More sharing options...
Uten Posted February 1, 2007 Share Posted February 1, 2007 Can't remeber the switch so take a look regsrv32.exe /?Lets say it was /s;Could be runwait is better ShellExecute("regsrv32.exe /s " & $pathtoregfile) Obviously I know nothing about the content in your reg file so it could be your problem lies there. If your running as a user (restricted) this should not go to the administrator account. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Arthur L Posted February 1, 2007 Author Share Posted February 1, 2007 the script im running runs under the administrator account while a standard user is logged-in. but i want the script to have a effect on the currently logged-in user. is it possible that when the regedit /s executes, it will run in the context of the logged-in user? Link to comment Share on other sites More sharing options...
Uten Posted February 2, 2007 Share Posted February 2, 2007 (edited) You could use RunAsSet But, I think, that would give you a headache if you don't have all the passwords.But I'm sure there is a way to do it. But unfortunately I don't know howto either. Maybe someone else could give some clues?EDIT: Wrong link type. Edited February 2, 2007 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
/dev/null Posted February 2, 2007 Share Posted February 2, 2007 (edited) the script im running runs under the administrator account while a standard user is logged-in. but i want the script to have a effect on the currently logged-in user. is it possible that when the regedit /s executes, it will run in the context of the logged-in user?what you need is reg.exe.You can write to a users hive (HKCU) by loading that hive to your current registry, modifying it, then unloading the hive.reg.exe LOAD HKLM\userhive "c:\documents and settings\user1234\ntuser.dat"reg.exe ADD HKLM\userhive\testkey ; HERE you can also use AU3 Reg* functions!reg.exe UNLOAD HKLM\userhiveHelp: reg /?This will only work, if the hive file (ntuser.dat) is NOT locked, e.g. because the user is logged on!!!WARNING: Be careful using reg.exe, as you can really f... up your registry!!EDIT: BTW, you could also write to HKEY_USERS\S-1-5-xxxxxxxxxx, but then you'll have to figure out the SID of the user you want to change.CheersKurt Edited February 2, 2007 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now