public void DeleteCredTest() { using (ShimsContext.Create()) { ShimImports.CredDeleteStringCredTypeInt32 = (string target, CredType type, int flag) => { return true; }; manager.DeleteCred("server01", CredType.Generic); } }
protected override void ProcessRecord() { CredentialManager credentialManager = new CredentialManager(); //Delete credential from store try { WriteVerbose("Deleting requested credential from Windows Credential Manager"); credentialManager.DeleteCred(Target, Type); } catch (Exception exception) { ErrorRecord errorRecord = new ErrorRecord(exception, "1", ErrorCategory.InvalidOperation, Target); WriteError(errorRecord); } }