Giter Site home page Giter Site logo

Comments (10)

jugatsu avatar jugatsu commented on June 5, 2024 3

@smurawski I'm just testing mwf 5.1 on windows 6.1 and found a nasty bug after powershell 5.1 was installed on windows 7 sp1 (doesn't testing 2008r2 yet).
Default Powershell Configuration Session, Microsoft.powershell has been unregistered and there is only Microsoft.powershell.workflow registered.
And therefore test-kitchen can't connect after succefully converge and reboot as WinRM doesn't accept connections.

As a workaround

# NOTE: add hotfix to Microsoft.powershell bug after WMF5.1 installation
# as Test-Kitchen couldn't connect via WinRM after reboot
if ENV['TEST_KITCHEN']
  registry_key 'HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce' do
    values [
      { name: '!FixPowershell5', type: :string, data: "C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoProfile -ExecutionPolicy Bypass -NonInteractive -Command \"sleep 120; Register-PSSessionConfiguration -Name Microsoft.powershell -Force\"" },
    ]
    only_if { powershell_out("$PSVersionTable.PSVersion.Major").stdout.strip.to_i < 5 }
    action :create
  end
end

# ensure Microsoft.powershell is enabled after WMF5.1 installation
powershell_script 'Register Microsoft.powershell session configuration' do
  code 'Register-PSSessionConfiguration -Name Microsoft.powershell -Force'
  not_if '(Get-PSSessionConfiguration -Name microsoft.powershell) -ne $null'
  action :run
end

include_recipe 'ms_dotnet::ms_dotnet4'
include_recipe 'powershell::powershell5'

from powershell.

smurawski avatar smurawski commented on June 5, 2024 2

There's work progress on this cookbook (and some of it's dependencies) in prep for Chef 13. We can remove wmf 5 support and update to wmf 5.1 as part of that process.

from powershell.

smurawski avatar smurawski commented on June 5, 2024 2

I'm working on this now.

from powershell.

jugatsu avatar jugatsu commented on June 5, 2024

@tas50 what do you think about this? I can start WIP PR for wmf5.1.

from powershell.

jugatsu avatar jugatsu commented on June 5, 2024

As per today announcement https://blogs.msdn.microsoft.com/powershell/2017/03/28/windows-management-framework-wmf-5-1-now-in-microsoft-update-catalog/ WMF5.0 will be removed from Download Center as of June 1, 2017.

As previously announced, WMF 5.1 is a required update for WMF 5.0, and may be installed directly over WMF 5.0. As of June 1, 2017, users with WMF 5.0 must upgrade to WMF 5.1 to receive support. At that time, WMF 5.0 will be removed from the Download Center and from the WSUS catalog.

I think we should deprecate wmf5.0 in powershell5 recipe until this time.

from powershell.

jugatsu avatar jugatsu commented on June 5, 2024

https://sysadminplus.blogspot.ru/2016/11/the-ws-management-service-cannot.html

from powershell.

jugatsu avatar jugatsu commented on June 5, 2024

Here we go

# NOTE: add hotfix to Microsoft.powershell bug after WMF5.1 installation
# as Test-Kitchen couldn't connect via WinRM after reboot
cmd = 'C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe'
cmd << " -NoProfile -Executionpolicy Bypass -NonInteractive -Command \"sleep 120;"
cmd << " Register-PSSessionConfiguration -Name Microsoft.powershell -Force\""

if ENV['TEST_KITCHEN']
  registry_key 'HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce' do
    values [
      { name: '!FixPowershell5', type: :string, data: cmd },
    ]
    only_if { powershell_out('$PSVersionTable.PSVersion.Major').stdout.strip.to_i < 5 }
    action :create
  end
end

# ensure Microsoft.powershell is enabled after WMF5.1 installation
powershell_script 'Register Microsoft.powershell session configuration' do
  code 'Register-PSSessionConfiguration -Name Microsoft.powershell -Force'
  not_if '(Get-PSSessionConfiguration -Name microsoft.powershell) -ne $null'
  not_if { powershell_out('$PSVersionTable.PSVersion.Major').stdout.strip.to_i < 5 }
  action :run
end

include_recipe 'ms_dotnet::ms_dotnet4'
include_recipe 'powershell::powershell5'

To workaround Access denied in WMF 2.0 when running Get-PSSessionConfiguration under System account I'm using second not_if guard

not_if { powershell_out('$PSVersionTable.PSVersion.Major').stdout.strip.to_i < 5 }

from powershell.

silverl avatar silverl commented on June 5, 2024

The support deadline for WMF 5.0 is a few days away (June 2017). Any news on WMF 5.1? Thanks.

from powershell.

jugatsu avatar jugatsu commented on June 5, 2024

@smurawski any progress on this issue? can i help with testing?

from powershell.

smurawski avatar smurawski commented on June 5, 2024

Sorry, I got hung up on some other stuff a while back. I'll start back up on this tomorrow and get a release out with 5.1.

from powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.