# Optimize Powershell in playbook

**URL:** <https://forum.ansible.com/t/optimize-powershell-in-playbook/32584>\
**Category:** Ansible Project\
**Created:** [April 2, 2020, 3:46am UTC](https://forum.ansible.com/t/optimize-powershell-in-playbook/32584 "2020-04-02T03:46:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_Obie](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@Barry\_Obie](https://forum.ansible.com/u/Barry_Obie)\
**Post date:** [April 2, 2020, 3:46am UTC](https://forum.ansible.com/t/optimize-powershell-in-playbook/32584/1 "2020-04-02T03:46:45Z")

</div>

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](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)?

---

<div class="post-metadata">

**Author:** ![Vivek\_Kothawale](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Vivek\_Kothawale](https://forum.ansible.com/u/Vivek_Kothawale)\
**Post date:** [April 2, 2020, 6:54am UTC](https://forum.ansible.com/t/optimize-powershell-in-playbook/32584/2 "2020-04-02T06:54:08Z")

</div>

Hi

Can you please provide error msg which you have encountered while running the  
Playbook ?

Thanks,  
Vivek

---

<div class="post-metadata">

**Author:** ![Barry\_Obie](https://avatars.discourse-cdn.com/v4/letter/b/c67d28/32.png) [@Barry\_Obie](https://forum.ansible.com/u/Barry_Obie)\
**Post date:** [April 2, 2020, 3:35pm UTC](https://forum.ansible.com/t/optimize-powershell-in-playbook/32584/3 "2020-04-02T15:35:47Z")

</div>

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.
