Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Add domain user to local admin group in another domain

$
0
0

I want to use Powershell to add the user domain2\user123 to the local admin group on server domain2\server123.  I want to be able to run the script from a workstation in domain1 and pass domain2 credentials.  Essentially I want to do this:

$creds= get-credential "domain2\admin123"$server="server123"$domain="domain2"

add-localgroup -credential $creds-computername $server-localgroup "Administrators"-user "domain2\user123"

I realize add-localgroup doesn't exist.  I just want that kind of functionality.  I've tried the [ADSI] methods but I can't use those against a server in another domain.

Thanks


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>