Class: Chef::Util::Powershell::PSCredential

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/util/powershell/ps_credential.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ PSCredential

Returns a new instance of PSCredential.



25
26
27
28
# File 'lib/chef/util/powershell/ps_credential.rb', line 25

def initialize(username, password)
  @username = username
  @password = password
end

Instance Method Details

#to_psobjectObject Also known as: to_s, to_text



30
31
32
# 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