Powershell itself is completely dependent on .net so I guess this is not surprising either.
I'd suggest trying win_scheduled_task module. If you are going to the trouble then it might be worth going straight to .net 4.7 - if so be aware of this (although you are on S2008SP2 so probably not affected): https://support.microsoft.com/en-us/help/4020302/the-net-framework-4-7-installation-is-blocked-on-windows-7-windows-ser Jon On Thursday, August 31, 2017 at 10:37:05 AM UTC+1, Sukanya shenoy wrote: > > Here is my playbook to install dotNet framework 4.5 > > - name: Windows Powershell Upgrade > hosts: tag_AnsibleCLI_windows > tasks: > - name: Install and upgrade powershell > win_shell: | > New-Variable -Name "file" -Value " > http://download.microsoft.com/download/b/a/4/ba4a7e71-2906-4b2d-a0e1-80cf16844f5f/dotnetfx45_full_x86_x64.exe > " > $client = New-Object System.Net.WebClient > $client.DownloadFile($file, > "C:\\Users\\smadmin.SOE2K8TDGOLD\\Downloads\\exmple.exe") > $client.DownloadFile(" > https://download.microsoft.com/download/3/D/6/3D61D262-8549-4769-A660-230B67E15B25/Windows6.1-KB2819745-x64-MultiPkg.msu", > > "C:\\Users\\smadmin.SOE2K8TDGOLD\\Downloads\\WMF.msu") > Start-Process -FilePath > "C:\Users\smadmin.SOE2K8TDGOLD\Downloads\exmple.exe" -ArgumentList "/q > /norestart" -Wait > > sukanya > > On Thursday, August 31, 2017 at 11:28:59 AM UTC+5:30, Sukanya shenoy wrote: >> >> Hi, >> I'm trying to upgrade powershell version on windows server 2008R2 through >> powershell commands. >> if I run those commands on powershell directly it is working fine but if >> use same commands in ansible playbook it is throwing Fatal Error. >> >> Please help me out . >> >> Thanks in advance, >> Sukanya >> > -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ea655083-1aef-41f9-8fb2-874821045a49%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.