class Chef::Util::Powershell::PSCredential

Public Class Methods

new(username, password) click to toggle source
# File lib/chef/util/powershell/ps_credential.rb, line 25
def initialize(username, password)
  @username = username
  @password = password
end

Public Instance Methods

to_psobject() click to toggle source
# File lib/chef/util/powershell/ps_credential.rb, line 30
def to_psobject
  "New-Object System.Management.Automation.PSCredential('#{@username}',('#{encrypt(@password)}' | ConvertTo-SecureString))"
end
Also aliased as: to_s, to_text
to_s()
Alias for: to_psobject
to_text()
Alias for: to_psobject

Private Instance Methods

encrypt(str) click to toggle source
# File lib/chef/util/powershell/ps_credential.rb, line 39
def encrypt(str)
  Chef::ReservedNames::Win32::Crypto.encrypt(str)
end