Skip to content

Instantly share code, notes, and snippets.

View brianvanderlugt's full-sized avatar

Brian Vander Lugt brianvanderlugt

  • MI
View GitHub Profile
@brianvanderlugt
brianvanderlugt / RebaseBranches.ps1
Last active November 13, 2020 16:27
GitRebaseBranches
param(
[Parameter(Mandatory)]
[String[]]$Branches
)
$newLineChar = [Environment]::NewLine
Write-Output $newLineChar
[String[]]$commitCountMsgs = @()
[String[]]$scriptOutputLines = @()
@brianvanderlugt
brianvanderlugt / CopyAzStorageContainer.ps1
Created May 13, 2020 14:14
PowerShell Az Blob Container Copy
#Requires -Modules Az
param(
[Parameter(Mandatory)]
[String]$StorageAccountName,
[Parameter(Mandatory)]
[String]$ContainerName,
[Parameter(Mandatory = $false)]
[String]$BlobFilter,
@brianvanderlugt
brianvanderlugt / PreRequisites.ps1
Last active April 12, 2025 20:53
PowerShell script to output graph dependency to help resolve nuget dependencies.
#Requires -RunAsAdministrator
# Pre-requisites
Install-Module PowerShellGet -Force # to install additional packages
Import-Module PowerShellGet -MinimumVersion 2.2.0
# Doesn't work because PowerShellGet doesn't support SemVer 2.0 yet. https://github.com/PowerShell/PowerShellGet/issues/222
Install-Package NuGet.Core,NuGet.ProjectModel
# Instead run. Recommmend copy as installs additional libraries already cover by NETStandard 2.0
@brianvanderlugt
brianvanderlugt / MoveDirectoriesRelatively.ps1
Created August 26, 2019 15:59
Moves directories relatively to a new location
$directoriesToMove = 'Backup'
$newDirectory = 'C:\target\directory'
(Get-ChildItem -Recurse -Path $directoriesToMove -Directory) | foreach{
$newPath = $($_.FullName.Replace("$PWD", $newDirectory));
$newPath = $newPath.Substring(0, $newPath.LastIndexOf('\'));
New-Item -Path $newPath -ItemType Directory | Out-Null;
Move-Item -Path $_.FullName -Destination $newPath}
@brianvanderlugt
brianvanderlugt / GetLogsParsed.ps1
Last active October 30, 2018 11:25
Parsing Storage Logging logs
function Get-LogsParsed{
param(
[Parameter(Mandatory,ValueFromPipeline=$true)]
[String]$Path
)
PROCESS{
Import-Csv -Path $Path -Delimiter ';' -Header @(
'version-number'
,'request-start-time'
@brianvanderlugt
brianvanderlugt / AzureADModuleInstallation.ps1
Created October 4, 2018 15:14
Install AzureAD on macOS
Register-PSRepository -Name PSGalleryInternal -SourceLocation https://dtlgalleryint.cloudapp.net/api/v2/ -InstallationPolicy Untrusted -PublishLocation https://dtlgalleryint.cloudapp.net/api/v2/package/ -ScriptPublishLocation https://dtlgalleryint.cloudapp.net/api/v2/package/ -ScriptSourceLocation https://dtlgalleryint.cloudapp.net/api/v2/items/psscript/ -PackageManagementProvider NuGet
Install-Module -Name AzureAD.Standard.Preview
@brianvanderlugt
brianvanderlugt / Dockerfile
Last active July 3, 2018 14:40
TDS Error on SQL Data Warehouse
# docker build -f Dockerfile -t datawarehous-insert-test .
# docker run -it --rm --env-file=env.azure datawarehous-insert-test
# env.azure has the connection details
FROM python:3.6-jessie
WORKDIR /usr/src/app
COPY install_ctds.sh requirements.txt ./
RUN ["/bin/bash", "-c", "./install_ctds.sh"]
RUN pip install --no-cache-dir -r requirements.txt
@brianvanderlugt
brianvanderlugt / DisableFirstRunCustomizeRegistry.ps1
Created March 9, 2018 21:17
DisableFirstRunCustomize registry entry for IE
# If you receive the following error message in PowerShell or VSTS agent this script fixes it:
# ErrorMessage: The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
$registryPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main'
$name = 'DisableFirstRunCustomize'
$value = 1
New-Item -Path $registryPath.Substring(0,$registryPath.LastIndexOf('\'))
New-Item -Path $registryPath
New-ItemProperty -Path $registryPath -Name $name -PropertyType DWORD -Value $value
@brianvanderlugt
brianvanderlugt / BOMCleanup.ps1
Created October 27, 2017 10:43
BOM Removal with PowerShell
function Remove-BOMFromFile{
param(
[Parameter(Mandatory)]
[ValidateScript({Test-Path -Path $_ -PathType Container})]
[String]$Path
)
foreach ($file in (Get-ChildItem -Path $Path -Include '*.hql' -Recurse))
{
if(Test-BOMInFile -File $file){