I’m just getting into learning more about powershell and the second project I have seems simple enough, but I can’t find the command to ‘clear’ the flag in ADSI.
The end goal is to have a prompt where someone can type in a username and it hit up ADSI to clear one flag from the account properties. If someone has a template I can use, I can expand off of it from there and fill in other flags and domain options I would really appreciate it.
If this is more difficult than I’m anticipating though, just let me know! I may have bitten off more than I can chew.
I think your description is a little vague. What “flag” would you like to “clear”? What ahve you tried already? You should search the internet and this forum for examples - there are thousands. If already have code you’ve got stuck with please share that code and we can try to help you.
Please read the instructions for this forum contained in the very first post of this forum: Read Me Before Posting! You’ll be Glad You Did!
Unfortunately the field name is proprietary so most of my search results are skewed, but it would be similar to the “homePhone” field in ADSI. There is a ‘clear’ button to remove any value set. Typically the field is a true, false, or <not set>. I just can’t find the command to say Clear to put it as the <not set> value.
For example I’ve got this. It’s not super complex, but I’m just missing one piece. Sorry if this is a dumb question:
[pre]#This part shows the current account info
Get-ADUser -identity USERNAME -properties Name,FLAG | Select-Object -property Name,FLAG #This part should be what sets it to <not set>
Set-ADUser USERNAME -identity USERNAME -FLAG ??? #This confirms the change
Get-ADUser -identity USERNAME -properties Name,FLAG | Select-Object -property Name,FLAG[/pre]
I had misunderstood the book I was reading over and took the -clear as a statement rather than a command so the errors didn’t make sense. After I saw it written out from you guys it made perfect sense.