No guarantees here, but you can at least try something like the following pseudocode
// DefaultCredentials returns an ICredentials reference // which can then be used to call GetCredentials, // and *that* returns a NetworkCredential. NetworkCredential netCredential = CredentialCache.DefaultCredentials.GetCredentials(..); // Now, with a NetworkCredential that *might* have a SecurePassword, you // could see if that would work to create a PSCredential. I haven't tested this, // and honestly I'm a bit dubious of the prospects, but its at least a thought. // There may be some translation necessary to even make that SecurePassword work, // assuming it is even available in your context, to something the PSCredential // can use. PSCredential psCredential = new PSCredential(netCredential.UserName, netCredential.SecurePassword);
As noted, this is untested pseudocode, but hopefully it gives you a push in the right direction. Good luck.