Goal:
I am building a Password Vault. I want to be able to restructure the table and change the names of the columns.
Question:
Is it possible to complete this task? And if yes how would I go about doing it?
Example:
UserName Resource Password Properties
-------- -------- -------- ----------
username My App password {[hidden, False], [applicationid, 0...
Is it possible to change the name of the column UserName,Resource and Password permanently for future entries?
function Get-SystemCreds{
param(
[switch]$AddCred,
[switch]$Getcred,
[switch]$RemoveCred
)
$vaultAssembly = [void][Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType=WindowsRuntime]
if($AddCred -eq $true){
$vaultAssembly
$ID= Read-Host 'Enter ID'
$Password= Read-Host 'Password'
$URL = Read-Host 'Enter URL'
$vault=New-Object Windows.Security.Credentials.PasswordVault
$cred=New-Object Windows.Security.Credentials.PasswordCredential($ID, $Password, $URL)
$vault.Add($cred)
}
if ($RemoveCred -eq $true){
$vaultAssembly
$ID = Read-Host 'Enter ID'
$cred = Get-SystemCreds -Getcred |
Where-Object {$_.UserName -eq $ID}
$vault.Remove($cred)
}
if ($Getcred -eq $true){
$vaultAssembly
(new-object Windows.Security.Credentials.PasswordVault).RetrieveAll() | % { $_.RetrievePassword(); $_ }
}
}
#Formats username column, sets different title for column
$format= @{Expression={$_.UserName};Label="UserNameColumnNameHere"} #Add comma and add formatting for other columns after here
(new-object Windows.Security.Credentials.PasswordVault).RetrieveAll() | % { $_.RetrievePassword(); $_ } | format-table $format
Assuming the format of the table uses variables named the same as those shown in your picture, this should allow you to reformat your table's names by applying the format-table function to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With