I'm trying to create a project that's creating users in active directory using powershell. All though, my problem is that let's say that I run this:
New-ADUser test1 -Givenname test -surname test -AccountPassword (ConvertTo-SecureString "abc" -AsPlainText -force)
As you know "abc" does not meet the password requirement, all though it adds the user anyways but without a password which in my project is not acceptable, I wan't to do this so if it fails in any parameter it should output the error without running the other parameters at all! I'd like this preferably in one line so I don't have to create scripts for it, just call it in my application. Tried multiple parameters such as -whatif and try, catch! Any kind of sources/answers are highly appreciated!