小编tho*_*jan的帖子

在 powershell 中比较两个凭据

我已经将凭据存储在 xml 文件中。

$myCredential=Get-Credential -Message "Enter the credentials."
$myCredential | Out-File "C:\cred.xml"
Run Code Online (Sandbox Code Playgroud)

现在,我有一个脚本,在运行时会提示并获取新凭据。

$newCredential= Get-Credential -Message "Enter your credential."
Run Code Online (Sandbox Code Playgroud)

那么,如何检查新提供的凭据是否与旧凭据匹配,而不将凭据解密为人类可理解的实际纯文本?

powershell

4
推荐指数
1
解决办法
2113
查看次数

Powershell 为什么两个json内容不同?

我有两个Byte[]类型的变量(我选择此类型是为了满足特定需要,因此需要保留它。),它们声明为:

$first = New-Object Byte[] 32
$second = New-Object Byte[] 32
Run Code Online (Sandbox Code Playgroud)

并且,我初始化了两个变量的每个索引。

现在,我创建了一个哈希表$List1

$List1=@{"First" = $first; "Second" = $second}
Run Code Online (Sandbox Code Playgroud)

我使用以下语法来创建 json 文件:

$List1 | ConvertTo-Json | Set-Content  -Path $jsonFile1
Run Code Online (Sandbox Code Playgroud)

这是第一个json文件内容:

{
"First":  {
             "value":  [
                           210,
                           195,
                           131,
                           176,
                           88,
                           154,
                           57,
                           37,
                           2,
                           75,
                           182,
                           190,
                           156,
                           43,
                           113,
                           199,
                           63,
                           25,
                           109,
                           92,
                           220,
                           91,
                           219,
                           252,
                           113,
                           68,
                           202,
                           12,
                           147,
                           194,
                           36,
                           177
                       ],
             "Count":  32
         },
"Second":  {
           "value":  [
                         238, …
Run Code Online (Sandbox Code Playgroud)

powershell json

3
推荐指数
1
解决办法
1947
查看次数

标签 统计

powershell ×2

json ×1