Win7 - Running script on command prompt

I am not sure to love it or hate it. The security setting in Win 7 is getting on my nerve. Prompting me this and blocking me that.

This is also a problem running script such as VB script in command prompt.

I encounter the following error when running my VB script to create a user in Active Directory

Active Directory: Access is denied
My account running the command prompt is administrator, but yet, it is saying I do not have the access right.

The main reason is Win 7 (security reason) run application without administrative right. As per they recommended, you should log in as normal user and use Run as administrator (right click on the exe) whenever you want to run the application.

The same reason applies to running script on command prompt. You need to use runas command. For example, to run a script with account admin, you can do the following

runas /profile /user:domain_A\admin "cscript.exe C:\add_user.vbs"

You can use the following to runas current user

runas /profile /user:%USERDOMAIN%\%USERNAME% "cscript.exe C:\add_user.vbs"

Comments

Popular Posts