Automation for command prompt- Using UiPath

Hi,

how do i automate the administartive command prompt? is there a solution for it?I tired screen scraping and type into but it didnt work

@Nivedita2 try to install Terminal Emulation Activities Pack and you will get all Terminal session activities.
Then you can use command prompt activities like get text, Send control key etc…

@rkelchuri is there any way to open normal command prompt in administrator mode and not in uipath terminal wizard??

@aksh1yadav @ddpadil team, please help Nivedita…

Hey @Nivedita2

if you wanna run command prompt with different user profile you have to use runas.

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: /profile is not compatible with /netonly.
NOTE: /savecred is not compatible with /smartcard.

Sample: - RunCmdAsDiffUsers.xaml (5.0 KB)

Regards…!!
Aksh

3 Likes

@aksh1yadav am getting an error like tis…

Why you are using selectors? i m mentioned the exe path in start process. just changes your system name if it is on domain then mentioned yourdomainname\username and in type into your current user password or which profile you wanna logged in.

@aksh1yadav tis is wat am runnning…yet am getting that error

yes that is what i mentioned earlier.

runas /noprofile /user:mycompanydomainname\akshay.yadav cmd

*if your system is on a domain then mention a domain name as well otherwise if you are not then just pass then username only.

it works for me.

Regards…!!
Aksh

1 Like

@aksh1yadav how do i exe. commands in admin prompt…like instead of me typing in it , i want to autotype it…i tired “type into” but didnt wrk and “indicate on screen” is also nt wrking for admin promt.

what exe you wanna type there?
or what application u wanna open with admin rights?

REgards…!!
Aksh

@aksh1yadav I want to the open command prompt in admin mode and run a installation through command prompt… but am not able to auto type the commands using “type into”

What command you are trying to run… like password working with type into you can pass that as well :slight_smile:

@aksh1yadav can u send me an example .xaml … just to find the hostname of the system from the admin command prompt

Hey @Nivedita2

I just wanted to know if you just wanna get System Host name then there is no need of admin rights you can simply get this with normal current user as well.

image

Regards…!!
Aksh

@aksh1yadav thank u for tis :slight_smile: …but i have got to execute few commands in administrator prompt… so wanted to know how to type in

it is the same just use the type into like that i have mentioned after password type into :slight_smile:

@aksh1yadav i tried urs…yet am getting selector not found although i didnt use any… nd i want the commands to get typed in automatically in admin prompt without me typing it.:roll_eyes:. …i tried “type in” but isn’t wrking in admin prompt

its working for me with the same approach.

you just have to pass the hostname with typeinto

RunCmdAsDiffUsers.xaml (5.6 KB)

Regards…!!
Aksh

@aksh1yadav sry if am bothering u alot…but :slightly_frowning_face: i tried urs…it did work… but…


getting an error lyk RUNAS unable to acquire password… and also anothr 1…