Link to home
Create AccountLog in
Avatar of ahfaris
ahfaris

asked on

Run Script with Current logged in user privileges

I want to run program at startup script for my domain users , but i want to run this script with current logged in user privileges , i am using runasspc tool to make professional runas but it request user &pass for the user want to run with , and i dont have credentials for all users , can any one help me .
Avatar of Cro0707
Cro0707
Flag of Croatia image

You can enter credentials in runas command:



N:\>runas /?
RUNAS USAGE:
 
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/user: program
 
RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]
/smartcard [/user:] program
 
/noprofile specifies that the user's profile should not be loaded.
This causes the application to load more quickly, but
can cause some applications to malfunction.
/profile specifies that the user's profile should be loaded.
This is the default.
/env to use current environment instead of user's.
/netonly use if the credentials specified are for remote
access only.
/savecred to use credentials previously saved by the user.
This option is not available on Windows XP Home Edition
and will be ignored.
/smartcard use if the credentials are to be supplied from a
smartcard.
/user should be in form USER@DOMAIN or DOMAIN\USER
program command line for EXE. See below for examples
 
Examples:
> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""
 
NOTE: Enter user's password only when prompted.
NOTE: USER@DOMAIN is not compatible with /netonly.
NOTE: /profile is not compatible with /netonly.

Open in new window

Avatar of ahfaris
ahfaris

ASKER

but i said i dont have credentials for all domain users to run script as .
If you want to run the script as the user, it needs to be a log-in script.  On domain computers you can't assume the user that is going to log-on anyway - so you can't runas a user account at startup.

There is no currently logged in user at startup, so what you are trying to do is in fact impossible.

User scripts need to be implemented as logon scripts.
Avatar of ahfaris

ASKER

ok i mean its login script , how can i do it ?
ASKER CERTIFIED SOLUTION
Avatar of purplepomegranite
purplepomegranite
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of ahfaris

ASKER

Thanks purplepomegranite: yes you are righ , but my case si speceific and i clarify it at this thread
https://www.experts-exchange.com/questions/23592022/Logon-Scripts-and-cached-logon-problem.html

thanks for your help
Avatar of ahfaris

ASKER

OK Sir , now i see