Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 21, 2013, 05:14:29 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to run mydefrag on XP from a standard user account with RUNAS ???  (Read 1695 times)
J0NES
Newbie
*
Posts: 1


View Profile
« on: September 15, 2009, 03:02:26 pm »

Hi, I am no computer wizard, so I have some problems finding the right way to run mydefrag as admin from a normal user account, maybe anybody could helo me?
I am working normally under an unprivileged account (on Windows XP), and I do not want to change to the admin user account every time I want to run mydefrag. As I understand the runas command is made for this situations - problem is that I can not use it - when I create a link like described in the manual, the option to run the program under another user account is not available (grey). I tried to execute it on the commandline - but it only shows me an error. I tried this:

Code:
C:\WINDOWS\system32\runas.exe /user:Laptop\Administrator "C:\Programme\MyDefrag v4.1.2\Scripts\FastOptimize.MyD C:"

and I get this error:
Code:
193: C:\Programme\MyDefrag v4.1.2\Scripts\FastOptimize.MyD C: ist keine zulässige Win32-Anwendung.

Yes, I only want to defragment my C drive, while I am away for a coffee break and stuff like this. I do not want to run it via the scheduler. Also this asks me for the admin password - how can I avoid this?

I would like to suggest to put this in the manual - I think this is a very basic situation for many users - especially the people not so well educated about windows internals should be happy NOT working as an Administrator, so the need for using MyDefrag with the runas command is there.

THANKS
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #1 on: September 15, 2009, 04:10:33 pm »

I tried to execute it on the commandline - but it only shows me an error. I tried this:
The problem is that you have spaces in the path to the script. You have to do something like this:
Code:
C:\WINDOWS\system32\runas.exe /user:Laptop\Administrator "\"C:\Programme\MyDefrag v4.1.2\Scripts\FastOptimize.MyD\" C:"

Quote
Also this asks me for the admin password - how can I avoid this?
There are some dirty tricks to circumvent Windows security, but I don't recommend it.

Quote
I would like to suggest to put this in the manual
You are the first person to ask how to run a program as administrator in all the years that MyDefrag (and JkDefrag) have been available. I think most people simply login as administrator, or give their userid administrator privileges.
Logged
revertex
Newbie
*
Posts: 1


View Profile
« Reply #2 on: October 21, 2009, 02:46:30 pm »

I registered in this forum just to answer your question.

I don't understand why everyone use windows with admin accounts and so few people use it as it should be used.

Maybe because windows made users life a hell if you decide to run as limited user.

There at least 2 ways you can do it, one is use windows build in task schedule to create a schedule task that run as admin, then execute it as user with schtasks.exe.
Suppose you created a schedule taks named mydefragtask:

Quote
C:\winnt\system32\schtasks.exe /run /tn mydefragtask

My favorite way is use the wonderful auto-it to create a executable that run as admin, without a need to supply username and password.

Here a stripped down version of my script.

Quote
; uncomment if you don't want trayicon
;#NoTrayIcon

;replace with your admin credentials
Local $sUserName = "administrator"
Local $sPassword = "password"

; Run a command as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 1, @ProgramFilesDir & "\MyDefrag v4.1.2\Scripts\FastOptimize.MyD", @ProgramFilesDir & "MyDefrag v4.1.2\Scripts\")

You need to install autoit to compile, but it is freeware as mydefrag.

http://www.autoitscript.com/autoit3/

The compiled exe is encrypted, your password cannot be easily found inside.

With little changes you can adapt this script to run almost everything as administrator without a need to supply credentials everytime.

I just wish some day windows can be versatile as linux, with tools like passwordless sudo.
Logged
cg
JkDefrag Hero
*****
Posts: 101


View Profile
« Reply #3 on: October 21, 2009, 07:01:38 pm »

I like AutoIt too... but why not just use the RunAs functionality built into Windows?
Logged
poutnik
JkDefrag Hero
*****
Posts: 1105


View Profile
« Reply #4 on: October 22, 2009, 08:53:24 am »

I like AutoIt too... but why not just use the RunAs functionality built into Windows?

The point is in automated providing of credentials without exposing the admin password.
by using Runas the user either has to provide password everytime,
either the password has to be exposed in the command in an open form.
Logged

It can be fast, good or easy. You can pick just 2 of them....
Treating Spacehog zone by the same effort as Boot zone is like cleaning a garden by the same effort as a living room.
cg
JkDefrag Hero
*****
Posts: 101


View Profile
« Reply #5 on: October 23, 2009, 05:38:05 am »

I guess that makes sense.  The only downside is its very easy to decompile an AutoIt executable, however that's beyond most users.

Too bad MyDefrag can't be registered as a Service.  Then you wouldn't have to worry about passwords for execution.  I know you can turn most programs into a service using 3rd party utilities, but I mean out of the box
Logged
Henno
JkDefrag Senior
****
Posts: 49


View Profile
« Reply #6 on: October 23, 2009, 06:51:42 am »

What't the problem here?
You can solve this with the following command:
schtasks /create /tn "Jeroen Kessels MyDefrag" /tr """"C:\Program Files\[path to program]MyDefrag.exe""" [Scriptname]" /sc "[whatever schedule] /ru "System"

This runs MyDefrag under the local system account, no password needed.

reg, Henno.

Logged
poutnik
JkDefrag Hero
*****
Posts: 1105


View Profile
« Reply #7 on: October 23, 2009, 06:57:36 am »

This is the way I use it, but defining it in Task scheduler GUI.
Logged

It can be fast, good or easy. You can pick just 2 of them....
Treating Spacehog zone by the same effort as Boot zone is like cleaning a garden by the same effort as a living room.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!