Search found 5 matches

by axi0m1989
Thu May 25, 2023 11:26 am
Forum: PowerShell GUIs
Topic: Unhandled Exception "System Error"
Replies: 8
Views: 537

Re: Unhandled Exception "System Error"

User exists, I can test this outside of Powershell Studio without GUI and it works fine. It just doesnt like the word "Continue" for some reason
by axi0m1989
Thu May 25, 2023 10:06 am
Forum: PowerShell GUIs
Topic: Unhandled Exception "System Error"
Replies: 8
Views: 537

Re: Unhandled Exception "System Error"

Narrowing it down. The system error is related to the "continue" if the check works correctly
by axi0m1989
Thu May 25, 2023 8:46 am
Forum: PowerShell GUIs
Topic: Unhandled Exception "System Error"
Replies: 8
Views: 537

Re: Unhandled Exception "System Error"

Running that code causes the system error. $button1_Click={ #TODO: Place custom script here $Cred = Get-Credential if ((Get-ADUser $Cred.UserName -Properties memberof).memberof -contains "GroupDistinguishedName") { continue } else { [System.Windows.Forms.MessageBox]::Show("User does n...
by axi0m1989
Wed May 24, 2023 5:46 am
Forum: PowerShell GUIs
Topic: Unhandled Exception "System Error"
Replies: 8
Views: 537

Re: Unhandled Exception "System Error"

So i changed the code to this and while i no longer get the error it is failing to check properly. This code does work without GUI if i do the checks in powershell ISE $button1_Click={ #TODO: Place custom script here $Cred = Get-Credential $ADUser = Get-ADUser $Cred.UserName -Properties memberof if ...
by axi0m1989
Fri May 19, 2023 7:01 am
Forum: PowerShell GUIs
Topic: Unhandled Exception "System Error"
Replies: 8
Views: 537

Unhandled Exception "System Error"

I am trying to code a button that will prompt you for credentials and then do an if/else statement on them. It doesnt seem to like -match. If i use -like or -contains then do not get this system error exception but i can't figure out why its throwing the error. Error.png This is what im trying to us...