0
I am trying to write a script which includes disk defragmentation as one of its steps. defrag
needs administrative rights to work. I tried to use runas /user:Administrator
, but it always asked me for password (even though there isn't one set).
The script needs to run unattended for a long time, and it needs to be started from standard user account (it is actually being run by cygwin), so I'd like to get rid of that prompt. Is this possible?
Thanks,
Most of that script don't need admin rights, so I'd like to avoid running full script with full privileges. – liori – 2010-06-28T20:33:56.393
@liori Yet defrag NEEDS to be run as administrator, there's no other way if you want to avoid retyping your password every time. – BloodPhilia – 2010-06-28T20:35:21.477
On Linux I can give user rights to run specific command as another user using
sudo
. Microsoft says Windows is superior to Linux, so there must be a way to do that :-) – liori – 2010-06-28T20:41:54.163Perhaps this is something for you: http://sourceforge.net/projects/sudowin/ OR http://www.howtogeek.com/howto/windows-vista/sudo-for-windows-vista/
– BloodPhilia – 2010-06-28T20:43:15.097I assumed there is something that doesn't require installing 3rd party software, like in a typical Linux installation... – liori – 2010-06-28T20:49:17.877
Not really, it's a much annoyed about subject really... that's why these 3rd party programs were created. The latter, http://www.howtogeek.com/howto/windows-vista/sudo-for-windows-vista/, should work pretty good.
– BloodPhilia – 2010-06-28T20:53:49.507@liori - on second thoughts, check this out: http://technet.microsoft.com/en-us/magazine/2007.06.utilityspotlight.aspx
– BloodPhilia – 2010-06-28T20:56:36.473I couldn't get
sudowin
to work in Win7. Both Start++ and the elevate script interactively show confirmation dialog, which I want to avoid. – liori – 2010-07-01T16:16:16.083