Skip to content

Instantly share code, notes, and snippets.

View gdbarron's full-sized avatar

Greg Brownstein gdbarron

View GitHub Profile
@Tiberriver256
Tiberriver256 / PowerShellNTFSStaticFileServer.ps1
Last active January 5, 2024 08:23
This script starts a small web server listening on localhost:8080 that will impersonate the authenticated user and serve static content. This means if they do not have NTFS permissions to the file they will get an access denied or a 404 file not found if they do not have NTFS access to list contents of the directory.
function Get-DirectoryContent {
<#
.SYNOPSIS
Function to get directory content
.EXAMPLE
Get-DirectoryContent -Path "C:\" -HeaderName "poshserver.net" -RequestURL "http://poshserver.net" -SubfolderName "/"
@Jaykul
Jaykul / ReadMe.md
Last active November 26, 2019 15:46
Making Publish-Module work with VisualStudio.com

This is a simple workaround solution for a complicated problem with registering VisualStudio online NuGet packages repositories as PowerShell module repositories.

The Problem with PowerShellGet

PowerShellGet just doesn't work with NuGet CredentialProviders, because it uses the -noninteractive switch whenever it calls nuget. However, the VisualStudio.com (VSO) nuget package repositories can work as internal PowerShell Galleries, because passing the credentials to Find-Module and Install-Module does work ...

Basically, the problem is two fold: authentication when publishing, and authentication when searching or installing. The second problem can be dealt with, inconveniently, by passing credentials every time. But the first cannot. These VSO repositories require a Credential Provider plugin to handle Microsoft Authentication (including support for 2-factor au