Keychain Scripting for network printers

I am needing a script that will remove all keychain items for shared printers. These are generic key, “Network Password” kind and in the users lonin keychain.

I have tried


tell application "Keychain Scripting"
	set deleteKey to delete every generic key
end tell

I was going delete everything just to see if I could delete a key but I get an error “Keychain Schipting got an error: Can’t get every generic key. Access not allowed”

I have tried to filter it down to just the “Network Password” but I cannot find the proper syntax.

Hi,

generic key is an element of keychain, not of application
try


tell application "Keychain Scripting"
	set networkPasswords to (get every generic key of keychain "login.keychain" whose description is "Network Password")
	repeat with onePassword in networkPasswords
		delete onePassword
	end repeat
end tell

Thanks,
That deletes all keys but the last one and gives the an error
“Keychain got an error: Can’t get item 2 of {generic key 1 of keychain “login.keychain”, generic key 2 of keychain “login.keychain”}.”
Or if there are 3 keys
“Keychain got an error: Can’t get item 3 of {generic key 1 of keychain “login.keychain”, generic key 2 of keychain “login.keychain”, generic key 3 of keychain “login.keychain”}.”

If I only have one key no errors, just works.