{"action":"created","issue":{"url":"https://api.github.com/repos/ferventcoder/vagrant-windows-puppet/issues/6","labels_url":"https://api.github.com/repos/ferventcoder/vagrant-windows-puppet/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/ferventcoder/vagrant-windows-puppet/issues/6/comments","events_url":"https://api.github.com/repos/ferventcoder/vagrant-windows-puppet/issues/6/events","html_url":"https://github.com/ferventcoder/vagrant-windows-puppet/issues/6","id":88492547,"number":6,"title":"Puppet set PATH not working and fail puppet calls later","user":{"login":"iDVB","id":189506,"avatar_url":"https://avatars.githubusercontent.com/u/189506?v=3","gravatar_id":"","url":"https://api.github.com/users/iDVB","html_url":"https://github.com/iDVB","followers_url":"https://api.github.com/users/iDVB/followers","following_url":"https://api.github.com/users/iDVB/following{/other_user}","gists_url":"https://api.github.com/users/iDVB/gists{/gist_id}","starred_url":"https://api.github.com/users/iDVB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iDVB/subscriptions","organizations_url":"https://api.github.com/users/iDVB/orgs","repos_url":"https://api.github.com/users/iDVB/repos","events_url":"https://api.github.com/users/iDVB/events{/privacy}","received_events_url":"https://api.github.com/users/iDVB/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2015-06-15T17:40:54Z","updated_at":"2015-06-18T22:57:41Z","closed_at":null,"body":"When running `vagrant up` for `win7x64pro-vagrant` it seems to run almost flawlessly until it trys to make puppet calls.\r\n\r\nIt's failing because the PATH vars are not being set. Which errors with ... \"The term 'puppet' is not recognized as the name of a cmdlet\"\r\n![Puppet PATH not set](http://goo.gl/F6Jx4Z)\r\n\r\nWhen Manually setting the path in the VM and then manually calling `puppet` I can then see that the path is correctly set.\r\n\r\nIs there a chance these scripts could be broken somewhere, or am I doing something wrong?\r\n\r\n```\r\nVirtualbox: 4.3.26\r\nVagrant: 1.7.2\r\nHost: OSX 10.10.3\r\n```\r\n\r\nUPDATE - Only other thing I can think of is that maybe the windows licensing prompt is crapping out the scripts? I intend to license only IF I can actually get this to work.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ferventcoder/vagrant-windows-puppet/issues/comments/113310969","html_url":"https://github.com/ferventcoder/vagrant-windows-puppet/issues/6#issuecomment-113310969","issue_url":"https://api.github.com/repos/ferventcoder/vagrant-windows-puppet/issues/6","id":113310969,"user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T22:57:41Z","updated_at":"2015-06-18T22:57:41Z","body":"Lots of looking into this, http://serverfault.com/a/8856/79259 seems to lead you down the correct path. For whatever reason, explorer.exe is not being notified of the updates, so any new app you start will still have the older environment variables. \r\n\r\nHowever, based on https://support.microsoft.com/en-us/kb/104011 it appears sometimes updates to environments don't make it out, so one can do this so explorer learns of the updates\r\n\r\n```c++\r\n SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,\r\n    (LPARAM) \"Environment\", SMTO_ABORTIFHUNG,\r\n    5000, &dwReturnValue);\r\n```\r\n\r\nAnd we can do that in powershell with http://poshcode.org/2049: \r\n\r\n```powershell\r\nif (-not (\"win32.nativemethods\" -as [type])) {\r\n    # import sendmessagetimeout from win32\r\n    add-type -Namespace Win32 -Name NativeMethods -MemberDefinition @\"\r\n[DllImport(\"user32.dll\", SetLastError = true, CharSet = CharSet.Auto)]\r\npublic static extern IntPtr SendMessageTimeout(\r\n    IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam,\r\n    uint fuFlags, uint uTimeout, out UIntPtr lpdwResult);\r\n\"@\r\n}\r\n\r\n$HWND_BROADCAST = [intptr]0xffff;\r\n$WM_SETTINGCHANGE = 0x1a;\r\n$result = [uintptr]::zero\r\n\r\n# notify all windows of environment block change\r\n[win32.nativemethods]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE,  [uintptr]::Zero, \"Environment\", 2, 5000, [ref]$result);\r\n```\r\n\r\nIf you want to add that somewhere after puppet is installed in one of the ps1 files and let me know if any new processes like cmd you start up on the box are good to go, I'd appreciate that and we can move forward with a fix."}}