How to RunAs from a script to the das.msc?

rated by 0 users
This post has 3 Replies | 1 Follower

Top 150 Contributor
Posts 7
Top Contributor
Tal Posted: 01-17-2010 2:00 AM

i wan to run the dsa.msc from the command line using the credentials the user puts in and that the AD manager should connect automaticly to a domain not where i am connected now /

 

$user = read-host " enter username
$passwd = read-host " enter password "

$domain = "internet.com"

runas /user:$user@domain /netonly "mmc dsa.msc /domain:$domain"

 

it connects to the domain which my computer is logged in and not to what is configured in the $ DOMAIN parameter

 

please help me

 

Top 10 Contributor
Posts 211
Top Contributor

Hi,

Hope this would help

$sh = new-object -com 'Shell.Application'
$sh.ShellExecute('dsa.msc', '','' , 'runas',1)

 

Top 150 Contributor
Posts 7
Top Contributor

thanks alot i will try it when i will Be at Work tommorow, can but help me uderstand what you did here in 2 line instead in 10 of mine ?

thanks

Top 10 Contributor
Posts 211
Top Contributor

Sure, let me know

Regards,
Krishna
http://smtpport25.wordpress.com

Page 1 of 1 (4 items) | RSS
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.