I want to remove a key of the kind 'network password' from the login.keychain using a script. But, I can't find a way to do it.
This is because we have an issue with Ricoh my print within our organisation. users have local profiles on their Macbooks but their credentials for printing are synced from AD. When they print, the AD credentials are saved to the keychain. When the AD password expires however, printing stops working until the keychain entry is deleted and replaced.
Endless hours of googling haven't helped, because it seems there's no way to identify the kind 'network password' within a script.
this is the key:
I tried the following script to make this work (username & path changed):
Security find-network-password -l "https://<myRICOHurl>" /Users/user_name/Library/Keychains/login.keychain
security delete-network-password -l "https://myRICOHurl" /Users/user_name/Library/Keychains/login.keychain
I tried the same, replacing netowrk with internet & generic, same effect. Also tried this:
security delete-network-password -l "RICOH My print" /Users/user_name/Library/Keychains/login.keychain
Can't get this to work, would appreciate any help or insight into what I'm doing wrong, or what I'm missing. I am a total newb at scripting for macs so be gentle with me :)
Thanks!