Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

powershell using adsi with alternate credentials

$
0
0

Hi,

I would like to check the local admin groups on a list of servers in another domain.

I have a domain admin account there.

I found this script snippet that get's the info for me in the domain I am currently loged on to.

$computer = [ADSI]("WinNT://" + $strComputer + ",computer")
  $Group = $computer.psbase.children.find("Administrators")
  $members= $Group.psbase.invoke("Members") | %{$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}

Is there a way to supply Alternate Credentials for this query? Or is there another method to do this?

Old Dog


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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