I want to know how to use NSIS script to remove credential manager data.
Could somebody help me?
How to delete credential manager by NSIS?
8 posts
Maybe you could link to a page on MSDN so we can understand which credentials you are talking about...
Hello Anders,Originally Posted by Anders View PostMaybe you could link to a page on MSDN so we can understand which credentials you are talking about...
I want to delete my credential data in Uninstall Section of NSIS script
And which API did your application use to store the credential?
This might work but without knowing how you saved it, I can't be sure.
This might work but without knowing how you saved it, I can't be sure.
System::Call 'advapi32::CredDelete(t "crednamehere", i 1, i0)' Hello Anders,Originally Posted by Anders View PostAnd which API did your application use to store the credential?
This might work but without knowing how you saved it, I can't be sure.
System::Call 'advapi32::CredDelete(t "crednamehere", i 1, i0)'
Thanks for your help.
I develop an application using electron and use this library to save the credential data https://github.com/atom/node-keytar
Could I put your code in the NSI file? Is any plugin required here?
The System plug-in is part of NSIS.
Replace crednamehere with "service/account" and those are the two parameters you used with keytar.
Replace crednamehere with "service/account" and those are the two parameters you used with keytar.
It's work perfectly thanks very much!
But one more question could we remove all credentials with specific text
Ex: I have user1, user2, user3... and I want to remove all credentials start with 'user'
But one more question could we remove all credentials with specific text
Ex: I have user1, user2, user3... and I want to remove all credentials start with 'user'
!include LogicLib.nsh
Section
System::Call 'ADVAPI32::CredEnumerate(t "user*", i0, *i0r1, *p0r2)i.r0'
${If} $0 <> 0
${IfThen} $1 U> 0 ${|} IntOp $1 $1 - 1 ${|}
${ForEach} $3 0 $1 + 1
IntOp $4 $3 * ${NSIS_PTR_SIZE}
System::Call '*$2(&i$4, p.r4)'
System::Call '*$4(i, i.r5, p.r6)'
System::Call 'ADVAPI32::CredDelete(t)(pr6, ir5, i0)'
${Next}
System::Call 'ADVAPI32::CredFree(pr2)'
${EndIf}
SectionEnd