PowerShell密码库

时间:2017-01-28 20:22:35

标签: powershell

目标:

我正在构建密码存储库。我希望能够重组表并更改列的名称。

问题:

是否可以完成此任务?如果是,我将如何去做呢?

示例:

UserName                                Resource                               Password                               Properties                            
--------                                --------                               --------                               ----------                            
username                                My App                                 password                               {[hidden, False], [applicationid, 0...

是否可以永久更改“用户名”,“资源”和“密码”列的名称以供将来输入?

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(); $_ }
  }
}

1 个答案:

答案 0 :(得分:4)

1

假设表的格式使用与图片中显示的变量名称相同的变量,这应该允许您通过将格式表函数应用于表来重新格式化表的名称。