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?

1 Answer 1

1

And I got it...

start-process powershell.exe -argument .\AdInfo.ps1 -credential ""
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.