zoukankan      html  css  js  c++  java
  • powershell创建密文密码文件

    $File = "\10.10.10.1 estPassword.txt"
    [Byte[]] $key = (1..16)
    $Password = "123456" | ConvertTo-SecureString -AsPlainText -Force
    $Password | ConvertFrom-SecureString -key $key | Out-File $File

     $a=Read-Host "请输入要修改的计算机名"
     $File = "\10.10.10.1 estPassword.txt“
     [Byte[]] $key = (1..16)
     $encpasswd = Get-Content $File
     $ss = ConvertTo-SecureString -String $encpasswd -Key $key
     $cred = New-Object System.Management.Automation.PSCredential 'test.cnzhangsan', $ss
     Add-Computer -ComputerName $a -DomainName test.cn -Credential $cred


     #加域
    Add-Computer -ComputerName Server01 -LocalCredential Server01Admin01 -DomainName Domain02 -Credential Domain02Admin02 -Restart -Force
    #退域
    Remove-Computer -UnjoinDomaincredential Domain01Admin01 -Passthru -Verbose -Restart

    https://www.pdq.com/blog/secure-password-with-powershell-encrypting-credentials-part-1/

  • 相关阅读:
    组合模式
    备忘录模式
    适配器模式
    状态模式
    观察者模式
    建造者模式
    地图染色-四色定理
    c++传递函数当作对象传递
    位向量实现集合—王晓东数据结构
    动态规划之最大连续子序列
  • 原文地址:https://www.cnblogs.com/victor0/p/13723275.html
Copyright © 2011-2022 走看看