Hi All,
I am new to PSS, but am loving what I see so far.
I have been writing PS1 scripts for several years and all has been nice, but this is a great tool to consolidate a lot of what I have done.
I am trying to create a form where I type in user first and surnames, and it checks if the user exists on Active Directory.
I have many scripts which run natively in PS and work, however, when I try to use them, they don`t see to work correctly.
When using Get-ADUser to see if a user exists, I can`t get PSS to give correct feedback.
Is there something I am missing....
My code looks like this:
if (dsquery user -samid $userID){$label1.Text="Y"}
elseif ($userID = "null") {$label1.Text="N"}
Any pointers would be greatly appreciated.
Creating Form to Check if AD user exists
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
-
- Posts: 1
- Last visit: Sun Oct 30, 2022 8:40 pm
Re: Creating Form to Check if AD user exists
- if{Get-Aduser -Filter "SamAccountName -eq '$userID'"}(
- $label1.Text = 'Y'
- }else{
- $userID = $null
- $label1.Text = 'N'
- }
The following free book (pdf) will help you to understand how logic works and how to use logic statements correctly.
https://www.sapien.com/books_training/W ... werShell-4