adding common scripts for use by multiple dev scenario scripts (#59)

This PR gets Master up to date with the common scripts approach.  These are not done but this seems far enough along to proceed.  We'll now move forward with refining these common scripts along with the dev scenario scripts that reference them.
This commit is contained in:
Yosef Durr
2018-08-02 15:07:12 -07:00
committed by GitHub
parent 2eac845847
commit 9270cd2d04
11 changed files with 234 additions and 157 deletions

View File

@@ -4,67 +4,41 @@
Disable-UAC
#--- Windows Subsystems/Features ---
#choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures
#choco install -y Microsoft-Hyper-V-All -source windowsFeatures
#choco install -y sysinternals
#choco install -y docker-for-windows
# see if we can't get calling URL somehow, that would eliminate this need
# should move to a config file
$user = "Microsoft";
$baseBranch = "BreakUpScripts";
$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts";
#--- Configuring Windows properties ---
#--- Windows Features ---
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
function executeScript {
Param ([string]$script)
write-host "executing $finalBaseHelperUri/$script ..."
iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script"))
}
#--- File Explorer Settings ---
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2
#--- Setting up Windows ---
executeScript "SystemConfiguration.ps1";
executeScript "FileExplorerSettings.ps1";
executeScript "RemoveDefaultApps.ps1";
executeScript "CommonDevTools.ps1";
#--- Enabling developer mode on the system ---
Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 1
#--- VS 2017 uwp and azure workloads + git tools ---
#--- Tools ---
#--- Installing VS and VS Code with Git
# See this for install args: https://chocolatey.org/packages/VisualStudio2017Community
# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community
# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio#list-of-workload-ids-and-component-ids
choco install visualstudio2017community --package-parameters "--add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Component.Git"
RefreshEnv
# visualstudio2017community
# visualstudio2017professional
# visualstudio2017enterprise
choco install visualstudio2017-workload-universal
#--- grabbing latest UWP Samples off Github ---
RefreshEnv
cd $env:USERPROFILE\desktop
mkdir UwpSamples
cd UwpSamples
git clone https://github.com/Microsoft/Windows-universal-samples/
# installing Windows Template Studio VSIX
#choco was claiming dev 15 can't do this anymore for vsix... odd hasn't been fixed yet
#Install-ChocolateyVsixPackage -PackageName "Windows Template Studio" -VsixUrl $wtsFileUrl.source
$requestUri = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery'
$requestBody = '{"flags":"262","filters":[{"criteria":[{"filterType":"10","value":"windows template studio"}],"sortBy":"0","sortOrder":"2","pageSize":"25","pageNumber":"1"}]}'
$requestHeaders = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$requestHeaders.Add('Accept','application/json; api-version=3.2-preview.1')
$requestHeaders.Add('Content-Type','application/json; charset=utf-8')
$results = Invoke-WebRequest -Uri $requestUri -Method POST -Headers $requestHeaders -Body $requestBody -UseBasicParsing
$jsonResults = $results.Content | ConvertFrom-Json
$wtsResults = $jsonResults.results[0].extensions | where {$_.extensionName -eq "WindowsTemplateStudio"}
$wtsFileUrl = $wtsResults.versions[0].files | where {$_.assetType -eq "Microsoft.Templates.2017.vsix"}
$wtsVsix = [System.IO.Path]::GetFileName($wtsFileUrl.source)
$wtsFullPath = [System.IO.Path]::Combine((Resolve-Path .\).Path, $wtsVsix);
Invoke-WebRequest -Uri $wtsFileUrl.source -OutFile $wtsVsix
$vsixInstallerFile = Get-Childitem -Include vsixinstaller.exe -Recurse -Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\"
$wtsArgList = $wtsFullPath + " /q"
$vsixInstallerResult = Start-Process -FilePath $vsixInstallerFile.FullName -ArgumentList $wtsArgList -Wait -PassThru;
Remove-Item $wtsVsix
choco install visualstudio2017community -y --package-parameters "--add Microsoft.VisualStudio.Component.Git"
RefreshEnv #refreshing env due to Git install
#--- UWP Workload and installing Windows Template Studio ---
choco install -y visualstudio2017-workload-azure
choco install -y visualstudio2017-workload-universal
executeScript "WindowsTemplateStudio.ps1";
executeScript "GetUwpSamplesOffGithub.ps1";
#--- reenabling critial items ---
Enable-UAC

View File

@@ -4,43 +4,27 @@
Disable-UAC
#--- Windows Features ---
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
# see if we can't get calling URL somehow, that would eliminate this need
# should move to a config file
$user = "Microsoft";
$baseBranch = "BreakUpScripts";
$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts";
#--- File Explorer Settings ---
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2
function executeScript {
Param ([string]$script)
write-host "executing $finalBaseHelperUri/$script ..."
iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script"))
}
#--- Git ---
choco install -y git -params '"/GitAndUnixToolsOnPath /WindowsTerminal"'
#--- Windows Subsystems/Features ---
choco install -y Microsoft-Hyper-V-All -source windowsFeatures
choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures
#--- Ubuntu ---
# Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.appx -UseBasicParsing
# Add-AppxPackage -Path ~/Ubuntu.appx
#--- Fonts ---
choco install -y inconsolata
# choco install -y ubuntu.font
#--- Tools ---
choco install -y docker-for-windows
choco install -y python
choco install -y 7zip.install
#--- Setting up Windows ---
executeScript "SystemConfiguration.ps1";
executeScript "FileExplorerSettings.ps1";
executeScript "RemoveDefaultApps.ps1";
executeScript "CommonDevTools.ps1";
executeScript "VirtualizationTools.ps1";
# TODO: install additional ML tools
#--- VS Code ---
choco install -y vscode
#--- VS Code extensions ---
choco install -y vscode-docker
Enable-UAC
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula

View File

@@ -1,49 +1,32 @@
# Description: Boxstarter Script
# Author: Microsoft
# Common dev settings for web dev
# Common settings for web dev
Disable-UAC
#--- Windows Features ---
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
function executeScript {
Param ([string]$script)
write-host "executing $finalBaseHelperUri/$script ..."
iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script"))
}
#--- File Explorer Settings ---
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2
# see if we can't get calling URL somehow, that would eliminate this need
# should move to a config file
$user = "Microsoft";
$baseBranch = "BreakUpScripts";
$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts";
#--- Setting up Windows ---
executeScript "FileExplorerSettings.ps1";
executeScript "SystemConfiguration.ps1";
executeScript "CommonDevTools.ps1";
executeScript "RemoveDefaultApps.ps1";
executeScript "VirtualizationTools.ps1";
#--- Tools ---
choco install -y vscode
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension msjsdiag.debugger-for-edge
choco install -y git -params '"/GitAndUnixToolsOnPath /WindowsTerminal"'
choco install -y 7zip.install
#--- Windows Subsystems/Features ---
choco install -y Microsoft-Hyper-V-All -source windowsFeatures
choco install Microsoft-Windows-Subsystem-Linux -source windowsfeatures
#--- Ubuntu ---
# Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.appx -UseBasicParsing
# Add-AppxPackage -Path ~/Ubuntu.appx
<#
#--- SLES ---
# Install SLES Store app
Invoke-WebRequest -Uri https://aka.ms/wsl-sles-12 -OutFile ~/SLES.appx -UseBasicParsing
Add-AppxPackage -Path ~/SLES.appx
# Launch SLES
sles-12.exe
# --- openSUSE ---
Invoke-WebRequest -Uri https://aka.ms/wsl-opensuse-42 -OutFile ~/openSUSE.appx -UseBasicParsing
Add-AppxPackage -Path ~/openSUSE.appx
# Launch openSUSE
opensuse-42.exe
#>
#--- Browsers ---
choco install -y googlechrome
choco install -y firefox
@@ -51,15 +34,6 @@ choco install -y firefox
#--- Microsoft WebDriver ---
choco install -y microsoftwebdriver
#--- Fonts ---
choco install -y inconsolata
# choco install -y ubuntu.font
#--- Tools ---
choco install -y sysinternals
choco install -y docker-for-windows
choco install -y python
Enable-UAC
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula

View File

@@ -1,49 +1,41 @@
# Description: Boxstarter Script
# Author: Microsoft
# Common dev settings for web development
# Common settings for web development with NodeJS
Disable-UAC
#--- Windows Features ---
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
# see if we can't get calling URL somehow, that would eliminate this need
# should move to a config file
$user = "Microsoft";
$baseBranch = "BreakUpScripts";
$finalBaseHelperUri = "https://raw.githubusercontent.com/$user/windows-dev-box-setup-scripts/$baseBranch/scripts";
#--- File Explorer Settings ---
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2
function executeScript {
Param ([string]$script)
write-host "executing $finalBaseHelperUri/$script ..."
iex ((new-object net.webclient).DownloadString("$finalBaseHelperUri/$script"))
}
#--- Tools ---
choco install -y vscode
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension msjsdiag.debugger-for-edge
choco install -y git -params '"/GitAndUnixToolsOnPath /WindowsTerminal"'
choco install -y 7zip.install
#--- Windows Subsystems/Features ---
choco install -y Microsoft-Hyper-V-All -source windowsFeatures
choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures
#--- Ubuntu ---
# Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.appx -UseBasicParsing
# Add-AppxPackage -Path ~/Ubuntu.appx
#--- Setting up Windows ---
executeScript "SystemConfiguration.ps1";
executeScript "FileExplorerSettings.ps1";
executeScript "RemoveDefaultApps.ps1";
executeScript "CommonDevTools.ps1";
executeScript "VirtualizationTools.ps1";
#--- Browsers ---
choco install -y Firefox
choco install -y Googlechrome
#--- Fonts ---
choco install -y inconsolata
# choco install -y ubuntu.font
#--- Tools ---
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension msjsdiag.debugger-for-edge
#--- Tools ---
choco install -y nodejs-lts # Node.js LTS, Recommended for most users
# choco install -y nodejs # Node.js Current, Latest features
choco install -y visualstudio2017buildtools
choco install -y visualstudio2017-workload-vctools
choco install -y sysinternals
choco install -y docker-for-windows
choco install -y python2 # Node.js requires Python 2 to build native modules
Enable-UAC

View File

@@ -0,0 +1,7 @@
# tools we expect devs across many scenarios will want
choco install -y vscode
choco install -y git -params '"/GitAndUnixToolsOnPath /WindowsTerminal"'
choco install -y python
choco install -y 7zip.install
choco install -y sysinternals

View File

@@ -0,0 +1,15 @@
#--- Configuring Windows properties ---
#--- Windows Features ---
# Show hidden files, Show protected OS files, Show file extensions
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
#--- File Explorer Settings ---
# will expand explorer to the actual folder you're in
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
#adds things back in your left pane like recycle bin
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
#opens PC to This PC, not quick access
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1
#taskbar where window is open for multi-monitor
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2

View File

@@ -0,0 +1,5 @@
RefreshEnv
cd $env:USERPROFILE\desktop
mkdir UwpSamples
cd UwpSamples
git clone https://github.com/Microsoft/Windows-universal-samples/

View File

@@ -0,0 +1,67 @@
#--- Uninstall unecessary applications that come with Windows out of the box ---
Write-Host "Uninstall unecessary applications that come with Windows out of the box" -ForegroundColor "Yellow"
#Referenced to build script
# https://docs.microsoft.com/en-us/windows/application-management/remove-provisioned-apps-during-update
# https://github.com/jayharris/dotfiles-windows/blob/master/windows.ps1#L157
# https://gist.github.com/jessfraz/7c319b046daa101a4aaef937a20ff41f
# https://gist.github.com/alirobe/7f3b34ad89a159e6daa1
# https://github.com/W4RH4WK/Debloat-Windows-10/blob/master/scripts/remove-default-apps.ps1
function removeApp {
Param ([string]$appName)
Write-Output "Trying to remove $appName"
Get-AppxPackage $appName -AllUsers | Remove-AppxPackage
Get-AppXProvisionedPackage -Online | Where DisplayNam -like $appName | Remove-AppxProvisionedPackage -Online
}
$applicationList = @(
"Microsoft.BingFinance"
"Microsoft.3DBuilder"
"Microsoft.BingFinance"
"Microsoft.BingNews"
"Microsoft.BingSports"
"Microsoft.BingWeather"
"Microsoft.CommsPhone"
"Microsoft.Getstarted"
"Microsoft.WindowsMaps"
"*MarchofEmpires*"
"Microsoft.GetHelp"
"Microsoft.Messaging"
"*Minecraft*"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.OneConnect"
"Microsoft.WindowsPhone"
"Microsoft.SkypeApp"
"Microsoft.WindowsSoundRecorder"
"*Solitaire*"
"Microsoft.MicrosoftStickyNotes"
"Microsoft.Office.Sway"
"Microsoft.XboxApp"
"Microsoft.XboxIdentityProvider"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
"Microsoft.NetworkSpeedTest"
"Microsoft.FreshPaint"
"Microsoft.Print3D"
#Non-Microsoft
"*Autodesk*"
"*BubbleWitch*"
"king.com.CandyCrush*"
"*Dell*"
"*Dropbox*"
"*Facebook*"
"*Keeper*"
"*Netflix*"
"*Twitter*"
"*Plex*"
"*.Duolingo-LearnLanguagesforFree"
"*.EclipseManager"
"ActiproSoftwareLLC.562882FEEB491" # Code Writer
"*.AdobePhotoshopExpress"
);
foreach ($app in $applicationList) {
removeApp $app
}

View File

@@ -0,0 +1,4 @@
#--- Enable developer mode on the system ---
Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 1

View File

@@ -0,0 +1,29 @@
choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures
choco install -y Microsoft-Hyper-V-All -source windowsFeatures
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName Microsoft-Hyper-V
choco install -y docker-for-windows
choco install -y vscode-docker
#--- Ubuntu ---
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.appx -UseBasicParsing
Add-AppxPackage -Path ~/Ubuntu.appx
<#
#--- SLES ---
# Install SLES Store app
Invoke-WebRequest -Uri https://aka.ms/wsl-sles-12 -OutFile ~/SLES.appx -UseBasicParsing
Add-AppxPackage -Path ~/SLES.appx
# Launch SLES
sles-12.exe
# --- openSUSE ---
Invoke-WebRequest -Uri https://aka.ms/wsl-opensuse-42 -OutFile ~/openSUSE.appx -UseBasicParsing
Add-AppxPackage -Path ~/openSUSE.appx
# Launch openSUSE
opensuse-42.exe
#>
# TODO: add tool installation inside Ubuntu

View File

@@ -0,0 +1,26 @@
# installing Windows Template Studio VSIX
Write-Host "Installing Windows Template Studio" -ForegroundColor "Yellow"
$requestUri = "https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery";
$requestBody = '{"flags":"262","filters":[{"criteria":[{"filterType":"10","value":"windows template studio"}],"sortBy":"0","sortOrder":"2","pageSize":"25","pageNumber":"1"}]}';
$requestHeaders = New-Object "System.Collections.Generic.Dictionary[[String],[String]]";
$requestHeaders.Add('Accept','application/json; api-version=3.2-preview.1');
$requestHeaders.Add('Content-Type','application/json; charset=utf-8');
$results = Invoke-WebRequest -Uri $requestUri -Method POST -Headers $requestHeaders -Body $requestBody -UseBasicParsing;
$jsonResults = $results.Content | ConvertFrom-Json;
$wtsResults = $jsonResults.results[0].extensions | where {$_.extensionName -eq "WindowsTemplateStudio"} ;
$wtsFileUrl = $wtsResults.versions[0].files | where {$_.assetType -eq "Microsoft.Templates.2017.vsix"};
$wtsVsix = [System.IO.Path]::GetFileName($wtsFileUrl.source);
$wtsFullPath = [System.IO.Path]::Combine((Resolve-Path $env:USERPROFILE).path, $wtsVsix);
Invoke-WebRequest -Uri $wtsFileUrl.source -OutFile $wtsFullPath;
$vsixInstallerFile = Get-Childitem -Include vsixinstaller.exe -Recurse -Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\";
$wtsArgList = "/quiet `"$wtsFullPath`"";
$vsixInstallerResult = Start-Process -FilePath $vsixInstallerFile.FullName -ArgumentList $wtsArgList -Wait -PassThru;
Remove-Item $wtsFullPath