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.



23
24
25
26
# File 'lib/chef/util/powershell/ps_credential.rb', line 23

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

Instance Method Details

#to_psobjectObject Also known as: to_s, to_text



28
29
30
# File 'lib/chef/util/powershell/ps_credential.rb', line 28

def to_psobject
  "New-Object System.Management.Automation.PSCredential('#{@username}',('#{encrypt(@password)}' | ConvertTo-SecureString))"
end