Tuesday, 15 August 2017

Connect DSA.MSC console to alternate domain and domain credentials

Hello Guys,

When I was cleaning up my system content, I found a old script which I used earlier for one of the requirement.

Requirement: 

To publish script in the Citrix Web application so that service desk agents can connect to the DSA.MSC console of different domains where they are granted Delegated rights to do Password resets and Unlock accounts 

Solution: 

When this requirement came to me, first thing that stroked my mind was thinking about "RUNAS" command to do the job.
So, I started to create something simple like below

runas /netonly /user:test.dom\servicedesk1 mmc c:\windows\system32\dsa.msc" 

But I was failed and did not work as per the requirement,  so did google searches and found this useful option to use with the runas command.

runas /netonly /user:test.dom\servicedesk1 "cmd /c mmc c:\windows\system32\dsa.msc"

Note: /User:domainame\username

So, I have built simple batch script to get the domain name and credentials from the service desk while executing the script.

REM ************Script Starts here *****************
@ECHO OFF
set /P Domainn=Enter Domain Name:
set /P Usern=Enter Username:

set userunas=runas /netonly /user:%domainn%\%usern% "cmd /c mmc c:\windows\system32\dsa.msc /domain=test.pr"

%userunas%

REM ************Script ENDs here *****************

 How script works ?

1) When the script is executed, the script will prompt the domain name, username and password details like in below snapshot
 
2)Once, all the details are entered correctly, the DSA console will connect to the domain name mentioned in the CMD window with credentials entered.
Now, the service desk connected to the domain with their own credentials with their Delegated access on the particular domain.

Note: Please make sure that you have the dsa.msc console application available on the system your are running this batch script otherwise it would fail. ( You probably, have to install the RSAT to get the DSA console application )
 

No comments:

Post a Comment