To re-phrase the question: Our current wifi is based on AD authentication. Is there a way to connect a particular machine using the bound account to the wifi network via bash or apple script?
Did you try the script you gave in post #4?
If you put the password in as a cleartext string literal, does the script work as intended?
If it doesn't work, and you instead use the WLAN's password, does it work then? Is the WLAN's password a pre-shared key, like the majority of consumer wifi AP's, or is the WLAN access controlled using a RADIUS server?
If the posted script actually works for a given password, then that's a different problem to solve than the script not working at all.
There are two separate questions here. The question in your 1st post is basically "How do I get a certain password?" The second question is in post #6.
The command to access the keychain is named 'security'. Its man page describes how to use it to get a password from a keychain.
However, the action of getting a password (or other protected secret) may itself be protected by the keychain password, which is prompted for using a dialog. The user can use the Keychain app to manage access control, but the default is to only grant access to the app that created the protected item.
Examples:
Code:
security find-internet-password -a chown33
# list the unprotected info for the 1st password with the given account name.
# you can further qualify the item; see the man page.
security find-internet-password -a chown33 -g
# get the secret password, if allowed.
# will prompt with a dialog, unless Access Control was previously granted.
I'll also point out that your script should use quoting when it expands shell variables. There are multiple places where this could be a problem. If any of the variables happens to contain a space (or any whitespace) embedded in it, then you'll get multiple args instead of one, and havoc may then ensue. See example:
https://forums.macrumors.com/thread...nts-files-and-settings.2037837/#post-24410656