Skip to content

Instantly share code, notes, and snippets.

View lennybacon's full-sized avatar
🏠
Working from home

Daniel Fisher lennybacon

🏠
Working from home
View GitHub Profile
@lennybacon
lennybacon / update-visualstudio.ps1
Last active January 16, 2020 10:50
Update all visual studio editions and instances equal or above 2017
$EventLogSourceName = "Visual Studio Updater"
if([System.Diagnostics.EventLog]::SourceExists($EventLogSourceName) -eq $false){
New-EventLog –LogName Application –Source $EventLogSourceName
}
$cacheDirs = @(
"C:\Program Files (x86)\Microsoft Visual Studio\Installer"
#"C:\ProgramData\Microsoft\VisualStudio\Packages",
#"C:\ProgramData\Microsoft\VisualStudio\Setup"
);
@lennybacon
lennybacon / Add-Windowes DefenderExclusionsForVisualStudio.ps1
Last active September 18, 2019 08:11
Windowes Defender Exclusions for Visual Studio and DevOps Build Agents
# .NET
Add-MpPreference -ExclusionPath "%WINDIR%\Microsoft.NET\"
Add-MpPreference -ExclusionPath "%WINDIR%\assembly"
# Visual Studio
Add-MpPreference -ExclusionProcess "devenv.exe"
Add-MpPreference -ExclusionProcess "msbuild.exe"
Add-MpPreference -ExclusionProcess "VBCSCompiler.exe"
Add-MpPreference -ExclusionPath "%ProgramFiles(x86)%\Microsoft SDKs\"
Add-MpPreference -ExclusionPath "%ProgramFiles(x86)%\Microsoft Visual Studio\"
@lennybacon
lennybacon / git-unattend.inf
Last active August 8, 2018 09:21
Git unattended installation file
;CREATE .\Git-2.12.2.2-64-bit.exe /SAVEINF="C:\Users\USERNAME\Desktop\git.inf"
;USE .\Git-2.12.2.2-64-bit.exe /LOADINF="PATH\TO\YOUR\INF.inf"
[Setup]
Lang=default
;Dir=C:\Program Files\Git
Group=Git
NoIcons=0
SetupType=default
Components=gitlfs,assoc,assoc_sh,consolefont
Tasks=
@lennybacon
lennybacon / update-git.ps1
Created August 8, 2018 09:20
Install or update git for windows
$gitSetupDirectory = "C:\Windows\temp"
$ino = "Inno Setup CodeFile:"
$params = @{
"$ino Bash Terminal Option" = "ConHost";
"$ino CRLF Option" = "CRLFAlways";
"$ino CURL Option" = "WinSSL";
"$ino Editor Option" = "VisualStudioCode";
"$ino Enable Symlinks" = "Enabled";
"$ino Path Option" = "Cmd";
@lennybacon
lennybacon / Update Visual Studio 2017.xml
Created August 7, 2018 08:37
Scheduled Task to silently update Visual Studio
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2018-06-19T12:30:48.9998232</Date>
<Author>.\Administrator</Author>
<URI>\Update Visual Studio 2017</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2018-06-19T04:00:00</StartBoundary>
@lennybacon
lennybacon / Setup-TfsBuildAgent.ps1
Last active June 21, 2022 20:24
Totally automated Team Foundation 2017 build agent setup
$tfsUrl = "https://domain.tld/";
$tfsCollection = "DefaultCollection";
$tfsProject = "projectName";
$nugetSourceName = "Libraries";
$nugetFeedUrl = "$tfsUrl/$tfsCollection/_packaging/Libraries/nuget/v3/index.json";
$nugetUserName = "TfsBuild";
$nugetPassword = "*******";
$ErrorActionPreference="Stop";
If(-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole(
@lennybacon
lennybacon / Install-VsixExtension.ps1
Last active October 17, 2019 15:24
Unattended install of Wix Toolset Visual Studio 2017 Extension
$extensionDisplayName = "Wix Toolset Visual Studio 2017 Extension";
$extensionApiVersion = "api-version=3.2-preview.1"
$marketplaceQueryUrl = "https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery";
$extensionQuery = "{`"flags`":`"262`"," +
"`"filters`":[" +
"{" +
"`"criteria`":" +
"[" +
"{`"filterType`":`"14`",`"value`":`"1033`"}," +
@lennybacon
lennybacon / Update-VisualStudio2017.ps1
Last active January 19, 2021 17:51
Headless update for Visual Studio
Write-Host "Update Visual Studio Installer" -ForegroundColor Cyan
# [Microsoft Developer community](https://developercommunity.visualstudio.com/content/problem/307261/unattend-self-update-of-vs-installer.html)
$vsCommunityDownloadUrl = "https://download.visualstudio.microsoft.com/download/pr/8a973d5d-2ccb-428c-8204-290a15d30e2c/be8c694b12879a8f47f34369d55d453c/vs_community.exe";
$vsSetupDirectory = "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Setup"
$vsCommunitySetupPath = "$vsSetupDirectory\vs_community.exe";
if((Test-Path -Path $vsSetupDirectory) -eq $false){
$r = md $vsSetupDirectory
}
if((Test-Path -Path $vsCommunitySetupPath) -eq $false){
@lennybacon
lennybacon / Set-Tls12AsDefaultDotNet.ps1
Created March 20, 2018 13:51
Set the TLS version to 1.2 as default for .NET
Set-ItemProperty -Path HKLM:\\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727 -Name SystemDefaultTlsVersions -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727 -Name SchUseStrongCrypto -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319 -Name SystemDefaultTlsVersions -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319 -Name SchUseStrongCrypto -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\Microsoft\.NETFramework\v2.0.50727 -Name SystemDefaultTlsVersions -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\Microsoft\.NETFramework\v2.0.50727 -Name SchUseStrongCrypto -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 -Name SystemDefaultTlsVersions -Value 1 -Type DWord
Set-ItemProperty -Path HKLM:\\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 -Name SchUseStrongCrypto -Value 1 -Typ
@lennybacon
lennybacon / Add-Python2ToPathEnvironmentVariable.ps1
Last active March 20, 2018 14:38
Add python 2 install location to the PATH environment variable
$path = ([System.Environment]::GetEnvironmentVariable("PATH").Replace("C:\Python27", "") + ";C:\Python27").Replace(";;", ";");
[System.Environment]::SetEnvironmentVariable("PATH", $path);
& SETX PATH "$path" /M