Or $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Some other ideas here : https://stackoverflow.com/questions/17794507/reload-the-path-in-powershell From: ansible-project@googlegroups.com <ansible-project@googlegroups.com> On Behalf Of Stuart Lowe Sent: 17 December 2020 17:37 To: ansible-project@googlegroups.com Subject: RE: [ansible-project] Trouble with win_chocolatey and OpenSSH Can you run Refreshenv Between the 2? From: ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com> <ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com>> On Behalf Of shad...@gmail.com<mailto:shad...@gmail.com> Sent: 17 December 2020 16:48 To: Ansible Project <ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com>> Subject: [ansible-project] Trouble with win_chocolatey and OpenSSH I'm using OpenSSH to connect to Windows boxes to avoid having to deal with WinRM. So far it is working pretty good, but I have found an issue and i'm hoping someone has an idea. This is what my tasks looks like: - name: install chocolatey win_chocolatey: name: chocolatey state: present - name: Remove the default public source win_chocolatey_source: name: chocolatey state: absent The first task runs fine, and installs chocolatey, since it is not on the box. The second fails with "Failed to find Chocolatey installation, make sure choco.exe is in the PATH env value". The PATH is not picking up that chocolatey has been added. If I add a win_reboot between the two, then it works fine. That seems like a bit excessive. Is there a way to get the PATH to update, or have ansible break the connection and reconnect? Mike A -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8fd68cab-525d-4f68-ac2c-c9efbd161996n%40googlegroups.com<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F8fd68cab-525d-4f68-ac2c-c9efbd161996n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Cstuart.lowe%40zeninternet.co.uk%7C3574f8a5e5d747f86fdd08d8a2b26f74%7Cf553766da74d4c29bbe3ae53a28c11d3%7C1%7C0%7C637438234551047966%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Zjxjm9iOtE1ey%2FixtDkTN4sWA7dZy6ezYN8TndBSCv4%3D&reserved=0>. -- Stuart Lowe Cloud and Hosting Support Engineer Zen Internet Team: 01706 902009 Web: zen.co.uk Proud to be a certified B Corporation This message is private and confidential. If you have received this message in error, please notify us and remove it from your system. Zen Internet Limited may monitor email traffic data to manage billing, to handle customer enquiries and for the prevention and detection of fraud. We may also monitor the content of emails sent to and/or from Zen Internet Limited for the purposes of security, staff training and to monitor quality of service. Zen Internet Limited is registered in England and Wales, Sandbrook Park, Sandbrook Way, Rochdale, OL11 1RY Company No. 03101568 VAT Reg No. 686 0495 01 -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/VI1PR01MB4317654A720DA61087A6A249A8C40%40VI1PR01MB4317.eurprd01.prod.exchangelabs.com<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FVI1PR01MB4317654A720DA61087A6A249A8C40%2540VI1PR01MB4317.eurprd01.prod.exchangelabs.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Cstuart.lowe%40zeninternet.co.uk%7C3574f8a5e5d747f86fdd08d8a2b26f74%7Cf553766da74d4c29bbe3ae53a28c11d3%7C1%7C0%7C637438234551057963%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=QmLTlG3pWGtOKcPe6U9hvv58Yjelyqo4U4jR95GFUBc%3D&reserved=0>. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/VI1PR01MB4317A44466EDA4F4D90D195DA8C40%40VI1PR01MB4317.eurprd01.prod.exchangelabs.com.