Hello fellow scripters,
I'm currently stumped on one question ...
What I'm trying to do
After connecting to a PSDrive (Filesystem Provider) using "New-PSDrive" with different Credentials I can read the credentials used, utilizing "Get-PSDrive". Once I close powershell and restart it however, I can connect without using the
credentials (which means they are cached somewhere) and the Credentials property on the PSDrive is empty.
I want to read the Username used in those credentials reliably, no matter whether powershell was closed and opened again.
Why
For common usage, that is good, as people dislike entering a password over and over again, so I do want to reconnect without asking for credentials. However, I have a scenario where I want to know the Username used in those credentials to connect each
time. During the first execution, that's simple (Get-PSDrive will return the info), however in later created processes I can't seem to be able to access this information.
Ideas so farNow I could write that info down somewhere during the first execution and read it again later on, but I would prefer to avoid doing this as much as possible. It adds complexity and is not reliable in some of our scenarios. Added to that, it would also violate some of our compliance rules (Writing down security relevant information - including user names - is prohibited at some of our customers).
Online search so far has only yielded ways to remove credentials (and manually, at that) ...
Cheers and thanks in advance for any insights,
Fred
There's no place like 127.0.0.1