Advertisement
Combreal

DeployWindowsBash.ps1

Mar 2nd, 2018
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Creer AppModelUnlock s'il n'existe pas,requit pour activer le mode developpeur
  2. $RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
  3. if (-not(Test-Path -Path $RegistryKeyPath)) {
  4.     New-Item -Path $RegistryKeyPath -ItemType Directory -Force
  5. }
  6.  
  7. #Ajouter une valeur de registre pour activer le mode developpeur
  8. New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1
  9.  
  10. #Activer la fonctionalite Sous systeme Windows pour linux
  11. Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  12.  
  13. #Lancer l'installation du Sous systeme Windows pour linux et créer l'utilisateur par defaut
  14. $command = @'
  15. cmd.exe /C start C:\Windows\System32\bash.exe lxrun /install /y
  16. cmd.exe /C start C:\Windows\System32\bash.exe lxrun /setdefaultuser $env:UserName /y
  17. '@
  18. Invoke-Expression -Command:$command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement