Login | |
|
 |
Adding to local admin, possible? - 10/25/2007 1:09:22 AM
|
|
 |
|
| |
hales
Posts: 13
Score: 0
Joined: 10/21/2007
Status: offline
|
Hi all, Complete newbie here, here's my scenario... Teachers with laptops, I'd like to write a script that will run on login that will add them to the administrators group on the local machine, and also a different script that will remove them from the administrators group (so that they can install programs at home), any ideas if this is possible/realistic? Not asking for handouts, just if it's possible (and of course if anyone's got any pointers, then that would be great!!), investigated using runas instead (i.e. a runas command and then they pick the executable but can't seem to get it working, so adding them to administrators on the local machine seems the easiest way round it) Thanks! Hales
|
|
| |
|
|
|
 |
RE: Adding to local admin, possible? - 10/25/2007 5:07:35 AM
|
|
 |
|
| |
ebgreen
Posts: 5035
Score: 31
Joined: 7/12/2005
Status: online
|
When you are trying to use .Run or .Exec to execute an external command, the way that you quote things is very important. To troubleshoot these issues, it is invaluable to know exactly what command is running so put this line right before the run: WScript.Echo strCommand Next take whatever it prints and enter it verbatim at the command line and see what error you get.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Adding to local admin, possible? - 10/26/2007 1:17:04 AM
|
|
 |
|
| |
Rischip
Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
|
Have people forgotten that the power users group exists for this purpose?
_____________________________
Rischip Author of - The Grim Linker
|
|
| |
|
|
|
 |
RE: Adding to local admin, possible? - 10/26/2007 7:10:34 AM
|
|
 |
|
| |
Rischip
Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
|
Yeah I get it, my point is that the power users group is designed to allow users to install software without fully allowing them to have admin authority. Also net localgroup /add administrators isn't going to work unless they run it as an admin. So if you have removed them from the admin group during the login script on the domain then they won't be able to run the net localgroup /add command. Also it is a security risk to supply an admin password within a script which will remain on the hard drive. Even if it is only a local admin. One more thing to note. If the admin credentials you are supplying in the script have not logged onto the pc before it was disconnected from the domain they will not be cached and the authentication will fail at home. The syntax of your command appears to be incorrect in the qoutes. Is AsAdmin a variable, or is it supposed to be text? I read it as a command line argument to determine whether to run a particular routine. If this is correct then it doesn't belong in the psexec command line
_____________________________
Rischip Author of - The Grim Linker
|
|
| |
|
|
|
|
|