{"action":"opened","issue":{"url":"https://api.github.com/repos/chef/chef/issues/3246","labels_url":"https://api.github.com/repos/chef/chef/issues/3246/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef/issues/3246/comments","events_url":"https://api.github.com/repos/chef/chef/issues/3246/events","html_url":"https://github.com/chef/chef/issues/3246","id":69633711,"number":3246,"title":"ps_credential doesn't work when run from winrm transport","user":{"login":"adamedx","id":2422125,"avatar_url":"https://avatars.githubusercontent.com/u/2422125?v=3","gravatar_id":"","url":"https://api.github.com/users/adamedx","html_url":"https://github.com/adamedx","followers_url":"https://api.github.com/users/adamedx/followers","following_url":"https://api.github.com/users/adamedx/following{/other_user}","gists_url":"https://api.github.com/users/adamedx/gists{/gist_id}","starred_url":"https://api.github.com/users/adamedx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamedx/subscriptions","organizations_url":"https://api.github.com/users/adamedx/orgs","repos_url":"https://api.github.com/users/adamedx/repos","events_url":"https://api.github.com/users/adamedx/events{/privacy}","received_events_url":"https://api.github.com/users/adamedx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-20T17:10:19Z","updated_at":"2015-04-20T17:10:19Z","closed_at":null,"body":"I ran this fragment via knife winrm, and it failed (see stack below). When I logged in interactively over RDP and then ran `chef-client`, it worked fine. Seems to be an issue with `ps_credential`:\r\n\r\n```\r\nadameddevz.cloudapp.net [2015-04-20T15:47:38+00:00] INFO: Processing dsc_resource[Create Test User] action run (dsc_resource_try::default line 43)\r\nadameddevz.cloudapp.net \r\nadameddevz.cloudapp.net ================================================================================\r\nadameddevz.cloudapp.net Error executing action `run` on resource 'dsc_resource[Create Test User]'\r\nadameddevz.cloudapp.net ================================================================================\r\nadameddevz.cloudapp.net \r\nadameddevz.cloudapp.net Chef::Exceptions::Win32APIError\r\nadameddevz.cloudapp.net -------------------------------\r\nadameddevz.cloudapp.net Access is denied.\r\nadameddevz.cloudapp.net ---- Begin Win32 API output ----\r\nadameddevz.cloudapp.net System Error Code: 5\r\nadameddevz.cloudapp.net System Error Message: Access is denied.\r\nadameddevz.cloudapp.net ---- End Win32 API output ----\r\nadameddevz.cloudapp.net \r\nadameddevz.cloudapp.net Resource Declaration:\r\nadameddevz.cloudapp.net ---------------------\r\nadameddevz.cloudapp.net # In C:/chef/cache/cookbooks/dsc_resource_try/recipes/default.rb\r\nadameddevz.cloudapp.net \r\nadameddevz.cloudapp.net  43: dsc_resource 'Create Test User' do\r\nadameddevz.cloudapp.net  44:   resource :user\r\nadameddevz.cloudapp.net  45:   property :username, 'testuser1'\r\nadameddevz.cloudapp.net  46:   property :password, ps_credential('xxxxxx')\r\nadameddevz.cloudapp.net  47:   property :ensure, 'Present'\r\nadameddevz.cloudapp.net  48: end\r\nadameddevz.cloudapp.net  49: \r\nadameddevz.cloudapp.net \r\nadameddevz.cloudapp.net Compiled Resource:\r\nadameddevz.cloudapp.net ------------------\r\nadameddevz.cloudapp.net # Declared in C:/chef/cache/cookbooks/dsc_resource_try/recipes/default.rb:43:in `from_file'\r\nadameddevz.cloudapp.net \r\nadameddevz.cloudapp.net dsc_resource(\"Create Test User\") do\r\nadameddevz.cloudapp.net   action :run\r\nadameddevz.cloudapp.net   retries 0\r\nadameddevz.cloudapp.net   retry_delay 2\r\nadameddevz.cloudapp.net   default_guard_interpreter :default\r\nadameddevz.cloudapp.net   properties {:username=>\"testuser1\", :password=>#<Chef::Util::Powershell::PSCredential:0x113c8e0 @username=\"placeholder\", @password=\"xxxxxxx\">, :ensure=>\"Present\"}\r\nadameddevz.cloudapp.net   resource :user\r\nadameddevz.cloudapp.net   declared_type :dsc_resource\r\nadameddevz.cloudapp.net   cookbook_name \"dsc_resource_try\"\r\nadameddevz.cloudapp.net   recipe_name \"default\"\r\nadameddevz.cloudapp.net end\r\nadameddevz.cloudapp.net\r\n```\r\n\r\nHere's the stack:\r\n\r\n```\r\nC:/opscode/chef/embedded/apps/chef/lib/chef/win32/error.rb:69:in `raise!'                                                   \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/win32/crypto.rb:33:in `encrypt'                                                 \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/util/powershell/ps_credential.rb:35:in `encrypt'                                \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/util/powershell/ps_credential.rb:29:in `to_psobject'                            \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:41:in `translate_type'                       \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:51:in `block in translate_hash'              \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:50:in `each'                                 \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:50:in `inject'                               \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:50:in `translate_hash'                       \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:30:in `block in type_coercions'              \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:39:in `call'                                 \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/mixin/powershell_type_coercions.rb:39:in `translate_type'                       \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/provider/dsc_resource.rb:133:in `invoke_resource'                               \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/provider/dsc_resource.rb:119:in `test_resource'                                 \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/provider/dsc_resource.rb:38:in `action_run'                                     \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/provider.rb:145:in `run_action'                                                 \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource.rb:561:in `run_action'                                                 \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:49:in `run_action'                                                    \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `block (2 levels) in converge'                                  \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `each'                                                          \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `block in converge'                                             \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'     \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'                          \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'           \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'                           \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'                       \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'                \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'              \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/runner.rb:80:in `converge'                                                      \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:331:in `block in converge'                                            \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:326:in `catch'                                                        \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:326:in `converge'                                                     \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:345:in `converge_and_save'                                            \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:449:in `run'                                                          \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:253:in `run_with_graceful_exit_option'                           \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:230:in `block in run_chef_client'                                \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'                                  \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:213:in `run_chef_client'                                         \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:392:in `block in interval_run_chef_client'                \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:382:in `loop'                                             \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:382:in `interval_run_chef_client'                         \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application/client.rb:372:in `run_application'                                  \r\nC:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:60:in `run'                                                      \r\nC:/opscode/chef/embedded/apps/chef/bin/chef-client:26:in `<top (required)>'                                                 \r\nC:/opscode/chef/bin/chef-client:63:in `load'                                                                                \r\nC:/opscode/chef/bin/chef-client:63:in `<main>'\r\n```"}}