Elevating permissions for based on the program, not user...
Hello all, I just started to set up a network at my home based on win2k3 server with Vista clients. Now, I want to keep my using Administrator accounts, since they aren't all that tech savy and as such will eventually mess up the system. My only promblem is that some of the programs that my family members use will crash is they don't have administrator rights. This isn't personally a problem for me, but since I can just type in the password for UAC, I'm good to go; but of course if I give out the admin password I've defeated the purpose of it.So, I've tried making some sort of scripts that basically: Start a J# script with the runas command (with the admin credentials), which in turn starts up said program and the UAC only prompts for a yes/no (w/o password). But the programs still crash. (The one that I observed w/ProcessMon seemed ok until it tried to read from the CD drive, getting a "FAST_IO_DISALLOWED" error)I've also tried adding the current user to the local admin group, starting the program, and then removing the local user from admin group, but that didn't work either, since net localgroup ... /add needs admin rights itself...So, my other ideas consist of: Giving them administrator accounts with restrictions (as opposed to standard accounts with 'additions')Logon script of some sort, since those start with admin rights.Some sort of server based script, (I have a notion that you can run scripts 'from' the server with admin rights... but I don't really know)I'm sure that this problem has been run into before, but I haven't been able to find any discussions relevant to this particular situation.Thanks in advance for your assistanceBtw, it's late and I seem to have misplaced my scripts-- I'll get those tomorrow and post em here.
December 8th, 2007 10:43am

Alrighty, I've gotten my scripts and here is how they currently work;The batch file starts a vbs script, giving it admin credentials, which in turn starts up a command shell and executes the runas command.Now, I have a js script with admin credentials. This script triggers a UAC prompt by trying to start up an executable specified in the batch file. Since this script is running w/admin credentials, the user only needs to click ok/cancel as opposed to typing in the password. This should work, but I've made a mistake somewhere, and instead of getting the UAC prompt, it just closes (no runtime errors detected).Here is the starting batch file, this particular example should launch a command prompt w/admin rights: Code Block runas.vbs DOMAIN\username UserPass launcher.js cmd.exeThis is the vbs file, really just em[vbs script]'Emulate the RunAs command in vbs.'Allow the RunAs command to be called'w/o letting the user know the admin password.'Syntax: runas.vbs <username> <password> <command> 'username = name of account to use 'password = password of specified account 'command = program to runset args = wscript.arguments 'eg, the parametersStop username = args(0) password = args(1)'since the command of runas may contain spaces'we must iterate through all items after username and password'and concantenate them into one command for the 'runas command.'a holdover from real languages like C/C++command = "" for i = 2 to args.count - 1 command = command & args.item(i) & " "nextcommand = "launcher.js "&command'run launcher.jsset aShell = wscript.createobject("Wscript.shell") aShell.run "runas.exe /user:"&username&" """&command&"""" 'wait a bit, and then "type" the password wscript.sleep(1000) 'wait one second 'send password and hit enter aShell.sendkeys( password & "{ENTER}" )'END of runas.vbs[/vbs]And here is the launcher.js, it should trigger a yes/no UAC prompt for the speciffied app.[j#]// elevate.js -- runs target command line elevated//Usage: {program} {commands}if (WScript.Arguments.Length >= 1) { Application = WScript.Arguments(0); Arguments = ""; for (Index = 1; Index < WScript.Arguments.Length; Index += 1) { if (Index > 1) { Arguments += " "; } Arguments += WScript.Arguments(Index); } new ActiveXObject("Shell.Application").ShellExecute(Application, Arguments, "", "runas"); } else { WScript.Echo("Usage:") WScript.Echo("elevate Application Arguments")}[/j#]
Free Windows Admin Tool Kit Click here and download it now
December 8th, 2007 11:23pm

Hi, Thank you for the post. Based on our experience, most applications should work well with Standard user permissions. Regarding the applications crash when running with Standard users in your environment, I would like to suggest that you contact the applications manufacturers to check the following two points: 1) Whether there are ungraded versions which are developed and tested for Windows Vista. 2) Whether we can delegate user permissions within these applications to ensure that Standard users can use the applications. Also, it should be a good idea to work around the issue by coding a script. If you need assistance on coding, you are welcome to post on our MSDN forums: http://forums.microsoft.com/msdn/default.aspx?siteid=1 Hope it helps. Sincerely, Joson Zhou Microsoft Online Community Support
December 12th, 2007 7:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics