5.1. Running a Task with Alternate Credentials
You want to run a task using a username and password other than the one you are currently logged in with.
Using a graphical user interface
Open the Start Menu.
Browse to the application you want to open.
For Windows 2000, press the Shift key and right-click on the application.
For Windows Server 2003, right-click on the application.
Select Run As.
You will be prompted to enter the username, password, and domain of the user whose credentials you want use for running the task.
Using a command-line interface
The runas.exe command allows you to run a command with alternate credentials:
> runas /user:
Here is an example:
> runas /user:AMER\rallen.adm "mmc.exe"
If you want to authenticate using credentials of a user that
does not have logon privileges to the local machine, you'll need to
/netonly option to
the runas command.
' This code shows how to use alternate credentials using WMI ' ------ SCRIPT CONFIGURATION ------ strServer = "
<ServerName>" ' e.g., fs01 strUser = "
<User>" ' e.g., AMER\rallen.adm strPasswd = "
<Password>" ' ------ END CONFIGURATION --------- on error resume next set objLocator = CreateObject("WbemScripting.SWbemLocator") set objWMI = objLocator.ConnectServer(strServer, "root\cimv2", _ strUser, strPasswd) if Err.Number <> 0 then WScript.Echo "Authentication failed: " & Err.Description end if ' Now you can use the objWMI object to get an instance of a class ' or ...