Hi, I have to put a msgbox showing if the order beneath was executed effectively or not
$buttonGrant_Click={
#$GroupTest = $textboxCheckGroup.Text
$textboxResultado.Lines = Add-ADGroupMember -Identity $textboxGroup.Text -Members $textboxLogin.Text
}
For example:
In the event that the order execute effectively shows the msg in the popup: 'Access Released'
On the off chance that the client as of now has bunch get to, show the msg in the popup: 'Client as of now has bunch access'
In the event that the order doesn't execute effectively, shows the msg in the popup: 'Order not executed, check the information entered.
Regards,
Grady M Kidwell
MsgBox Execution Query
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.
Re: MsgBox Execution Query
Hi. To do that you would need to use Try/CAtch to detect the error then use [System.Windows.Forms.Messagebox]::Show('your message here')
See:
https://info.sapien.com/index.php/guis/ ... ox-control
https://docs.microsoft.com/en-us/powers ... wershell-7
See:
https://info.sapien.com/index.php/guis/ ... ox-control
https://docs.microsoft.com/en-us/powers ... wershell-7
Re: MsgBox Execution Query
Is there a way to make both modal window and the parent form enabled at the same time?
Re: MsgBox Execution Query
No. That is what "modal" means. A child form is modal to the parent. The parent is not executing. This is a limitation of forms in PowerShell due to the threading capability.
You can open a form in a new runspace and it will be modeless to the parent form as it runs in a new thread (runspace).
You can open a form in a new runspace and it will be modeless to the parent form as it runs in a new thread (runspace).