Loading...

Follow Jonathan Medd's Blog | Automating anything tha.. on Feedspot

Continue with Google
Continue with Facebook
or

Valid

As part of a large configuration script for Windows, and executed via Ansible, one step was to remove SMB1.

The official Microsoft Guidance on removing SMB1 states to use Disable-WindowsFeaturehttps://support.microsoft.com/en-gb/help/2696547/detect-enable-disable-smbv1-smbv2-smbv3-in-windows-and-windows-server

I didn’t think too much more of this and simply added the step to the configuration script. However, upon executing it from Ansible I received the following error:

This got me questioning why is the recommendation to use Disable-WindowsOptionalFeature when the detect method is Get-WindowsFeature? It might seem more logical that Uninstall-WindowsFeature would be paired with Get-WindowsFeature.

I found this article which highlights some of the differences between the two different sets of commands that do pretty similar things: https://peter.hahndorf.eu/blog/WindowsFeatureViaCmd

I simply switched to Uninstall-WindowsFeature -Name ‘FS-SMB1’ and all was good.

Other alternatives are the native Ansible modules for configuring feature state:

We choose not to go down this route in this instance since there were many other items which needed to be configured in Windows which could not be done via Ansible modules and it was more practical to keep everything in a single PowerShell script.

We could of course take out SMB1 from the Windows template, but that’s another story……

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

While working on a scenario where I needed to automate the installation of SCVMM 2019, firstly via PowerShell scripts and then those scripts plugged into an Ansible playbook, I encountered some failures during the Ansible execution of the PowerShell scripts. These same scripts had worked fine when run locally on the Windows 2016 Server designated to run SCVMM.

The PowerShell scripts automated the install of three components; SQL, ADK and SCVMM. They were based on the examples you can find below:

https://github.com/microsoft/WSLab/blob/master/Tools/1_SQL_Install.ps1

https://github.com/microsoft/WSLab/blob/master/Tools/2_ADK_Install.ps1

https://github.com/microsoft/WSLab/blob/master/Tools/3_SCVMM_Install.ps1

When executed locally on the same Windows 2016 server all was good, the components were successfully installed. However, when running an Ansible job which included copying those scripts to the same server and executing them in the same order it would fail part the way through the install of SCVMM with winrm issues. It was also possible to re-produce similar winrm issues by executing the scripts from a remote PowerShell session with Invoke-Command, instead of executing them from Ansible.

Another alternative we tried was to create local scheduled task on the Windows Server which would execute the install script for SCVMM and run the scheduled task from an Ansible job. We discovered that the scheduled task would keep running and could be returned to in order to observe the result (which was a successful install), however we still received a winrm issue to the Ansible job:

This started to lead us to the actual answer, that some part of the SCVMM installation process was interrupting the winrm connection. The answer could be found in these two links for Ansible and pywinrm:

https://github.com/diyan/pywinrm/pull/174/files

https://github.com/ansible/ansible/issues/25532

They described the exact same issue we had with installing SCVMM from Ansible, with some operations causing winrm to become unavailable, and a proposed fix by adding some retries to the winrm session. Hoping that this gets merged to pywinrm, in the meantime I have separate Ansible playbooks to kick off the scheduled task and then check its status later.

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Following on from the highly successful 1 day PowerShell conference events run in 2017 and 2018 this year we are heading out of London and up to the International Convention Centre in Birmingham. See full details below:

https://psday.uk/

We’re SO excited to announce the final date and location of PSDay.UK 2019.

Please join us this year on Saturday 28th September 2019 in Birmingham at the International Convention Centre (ICC) for a fun day learning PowerShell, DevOps, Cloud & Automation from community & industry experts for Beginners to Advanced practitioners.

A near-final session schedule will be published within two weeks from today on our website PSDay.UK.

We’ve made the ticket as affordable as possible. Please get yours now at PSDay.UK for only £89 to secure your seat and to show your support for our work to help you accelerate & grow your careers.

All tickets are 100% refundable before 21st September 2019 and transferable to another person up to 3 days before the event.

The event will start at 10:00 AM and run until 6:00 PM. Registration will open at 9:00 AM. The later than usual conference start should allow the majority of you enough time to travel to Birmingham in the morning before the event. In case you are travelling from further away, we will give you access to our exclusive hotel finder & booking service.

For the bargain price of only £89 you will get:

  • At least three session tracks to choose from. Covering PowerShell, DevOps, Cloud & Automation topics for Beginners to Advanced practitioners.
  • We might add a fourth track to fit in all the amazing sessions submitted by our speakers.
  • Attend any session you like. Mix’n match sessions & tracks as you see fit.
  • Free parking at the Arena Birmingham next to the ICC, saving you £15.
  • 20% discount on Virgin Trains advance tickets for those travelling from Blackpool, Edinburgh, Glasgow, Liverpool, London, Manchester, etc.
  • Hot & cold lunch buffet and fruits, snacks, coffee, tea & water throughout the day.
  • Free WiFi access for all your devices to share your PSDayUK experience with the world, follow along and work if you need to.
  • You will have access to our hotel finder & booking service to secure a good deal on your room in case you want/need to stay in Birmingham before and/or after the event.

Please get your ticket now at PSDay.UK for only £89. Follow us on Twitter at @psdayuk for speaker & session announcements. Our social media hashtag is #PSDayUK.

Thanks very much,

PSDayUK organiser team

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

On Wednesday 10th October 2018 a group of people involved with organising PowerShell User Group events around the UK will be hosting a 1 day PowerShell conference at CodeNode in London, PSDayUK. This follows on from the highly successful event run last year.

An agenda will be published soon, once the session submissions have been reviewed. If you are interested in presenting then please fill out this form and your submission will be included in the review process.

Blind bird ticket (i.e. no agenda) pricing is available now at a significant discount.  All of the sessions from last year were recorded and published to the event’s YouTube channel, so you can get a good of the likely content by checking out those videos.

Hope to see you there.

  • Show original
  • .
  • Share
  • .
  • Favorite
  • .
  • Email
  • .
  • Add Tags 

Separate tags by commas
To access this feature, please upgrade your account.
Start your free month
Free Preview