I have a GUI to create new AD users that is 99% complete. On form load event, I have added $cred = Get-Credential, which when I launch the PS GUI it opens the credential window.
$formNewUserCreat_Load={
#TODO: Initialize Form Controls here
#Get User Credential - Form will close if Cancelled or Closed
$cred = Get-Credential
I am using the Button_Click event to create the new user account using -Credential $Cred as below. When I click on the Submit button, it opens another Credential window, I type in the user name and password and the account is created.
New-ADUser @User -Credential $Cred
Why am I being prompted for the 2nd credential window?
Get-Credential - ButtonSubmit_Click
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.