Thanks for the reply.The task actually succeeds (shows as changed). But when I go to the host, the assemblies show as not installed. The task does have a stderr output though: Connecting to local system... Starting PSEXESVC service on local system... Connecting with PsExec service on windows-server... Starting powershell.exe on windows-server... powershell.exe exited on windows-server with error code 0.
This is what the server shows when I check for the installed assembly: PS C:\Windows\system32> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe display C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.ISECommon\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.PowerShell.ISECommon.dll Microsoft (R) CLR Native Image Generator - Version 4.8.3761.0 Copyright (c) Microsoft Corporation. All rights reserved. Error: The specified assembly is not installed. On Thu, Apr 2, 2020 at 12:54 AM Vivek Kothawale <[email protected]> wrote: > Hi > > Can you please provide error msg which you have encountered while running > the > Playbook ? > > Thanks, > Vivek > > > > On Thu, Apr 2, 2020, 9:17 AM UnknownGnome <[email protected]> wrote: > >> Hello, >> >> I'm trying to get a playbook working that will run the Optimize >> Powershell script that is here: >> https://docs.ansible.com/ansible/latest/user_guide/windows_performance.html >> >> The playbook succeeds, but when I check for one of the installed >> assemblies on a host, it shows as not installed. >> >> Has anyone ever successfully done this? Is there a better way to get that >> script to run on all of my hosts (and any new ones as they come up)? >> >> >> --- >> - name: Optimize Powershell >> hosts: all >> gather_facts: yes >> tasks: >> - name: Copy script >> win_copy >> src: "{{fileserver}}\\Open\\Scripts\\Optimize-Powershell.ps1" >> dest: C:\temp\Optimize-Powershell.ps1 >> remote_src: yes >> - name: Copy PsExec >> win_copy: >> src: "{{fileserver}}\\Open\\PSTools\\PsExec.exe" >> dest: c:\temp\psexec.exe >> remote_src: yes >> - name: Run script through psexec >> win_psexec: >> command: >> "powershell.exe -executionpolicy bypass -noninteractive -nologo -file C: >> \\temp\\Optimize-Powershell.ps1" >> executable: C:\temp\psexec.exe >> elevated: yes >> nobanner: yes >> interactive: yes >> username: "{{adminuser}}" >> password: "{{adminpass}}" >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/d1d1b8af-1e52-4b93-8486-274cce948ce0%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/d1d1b8af-1e52-4b93-8486-274cce948ce0%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/zrGbNVQ9UHU/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAA420E8w%3DB1R4notA%3D73RQUY1-zbU5u18WLGjhqBftJ-Xey0jg%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAA420E8w%3DB1R4notA%3D73RQUY1-zbU5u18WLGjhqBftJ-Xey0jg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAEEELxQpmB5CU41KDvyisTo6u4MZL_BXkcu_VHqUQuTv2TbUHA%40mail.gmail.com.
