0

I have a script called ADInfo.ps1 that is used to query AD using the ActiveDirectory module in Powershell. In order to run the script, you must be running Powershell as an AD user. This is not an issue with most of our customers as we log into most of our customer's servers with AD accounts - but not always. I know that we can run this to open a new PS window with AD credentials:

Start-Process powershell.exe -Credential ""

I'm trying to take the thought out of this for my team, so I'm trying to find a way to run the script, and if it finds it's not running PS as a domain account that it will prompt for AD credentials and re-run the script. So is there a variation of the line above where I could force it to launch

.\ADInfo.ps1

as an Active Directory user?

Christopher Cass
  • 817
  • 4
  • 19
  • 31

1 Answers1

1

And I got it...

start-process powershell.exe -argument .\AdInfo.ps1 -credential ""
Christopher Cass
  • 817
  • 4
  • 19
  • 31