This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Port = "8080" | |
netstat -a -n -o | where { $_ -match $Port } | foreach { | |
$Process = Get-Process -PID (($_ -replace "\s+"," ") -split " ")[-1] | |
"Process: $($Process.ProcessName) ($($Process.Id)) is using $Port" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/pwsh | |
Install-Module -Name Get-ChildItemColor, oh-my-posh, posh-git, nvm -Force | |
md ~\.config\powershell | |
"Set-Theme -name Darkblood" | Out-File $Profile -Append | |
Install-NodeVersion 8 | |
Install-NodeVersion 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure Windows | |
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar | |
Update-ExecutionPolicy Unrestricted | |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | |
Install-Module -Name Get-ChildItemColor,posh-git,terminal-icons -Force | |
## Git | |
winget install -e --accept-source-agreements --silent --accept-package-agreements --id Git.Git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user32 = Add-Type -Name 'user32' -Namespace 'Win32' -PassThru -MemberDefinition @' | |
[DllImport("user32.dll")] | |
public static extern int GetWindowLong(IntPtr hWnd, int nIndex); | |
[DllImport("user32.dll")] | |
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); | |
[DllImport("user32.dll", SetLastError = true)] | |
public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint crKey, int bAlpha, uint dwFlags); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace Microsoft.AspNetCore.Builder; | |
using namespace Microsoft.AspNetCore.Http; | |
using namespace System; | |
using namespace Microsoft.AspNetCore.Hosting; | |
# If you don't have Visual Studio Installed this should work fine | |
# Install-Package Microsoft.AspNetCore -Source nuget.org -Destination .\.nuget\packages | |
# Install-Package Microsoft.AspNetCore.Server.Kestrel -Source nuget.org -Destination .\.nuget\packages | |
$LibFolder = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$FilePaths = @() | |
$FilePaths = (Get-WmiObject win32_process -filter "name like 'notepad.exe'") | | |
foreach { ($_.commandline -split " ",2)[1] } | |
if($FilePaths.count -gt 1) { | |
$FilePath = $FilePaths | Out-GridView -PassThru -Title "Select the open file you would like to search" | |
} else { | |
$FilePath = $FilePaths | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DirectoryContent { | |
<# | |
.SYNOPSIS | |
Function to get directory content | |
.EXAMPLE | |
Get-DirectoryContent -Path "C:\" -HeaderName "poshserver.net" -RequestURL "http://poshserver.net" -SubfolderName "/" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$LicenseSKUToNameMapping = @{ | |
'SHAREPOINTENTERPRISE_MIDMARKET' = 'SharePoint Online (Plan 1)' | |
'ESKLESSWOFFPACK_GOV' = 'Microsoft Office 365 (Plan K2) for Government' | |
'AAD_BASIC' = 'Azure Active Directory Basic' | |
'AAD_BASIC_AAD_BASIC' = 'Azure AD Basic - Azure Active Directory Basic' | |
'AAD_BASIC_EDU' = 'Azure Active Directory Basic for EDU' | |
'AAD_EDU' = 'Azure Active Directory for Education' | |
'AAD_PREMIUM' = 'Azure Active Directory Premium P1' | |
'AAD_PREMIUM_AAD_PREMIUM' = 'Azure AD Premium P1 - Azure AD Premium P1' | |
'AAD_PREMIUM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function New-PSWebServer { | |
<# | |
.Synopsis | |
Creates a web server that will invoke PowerShell code based on routes being asked for by the client. | |
.Description | |
New-PSWebServer creates a web server. The web server is composed of a schema that defines the client's requests to routes where PowerShell code is executed. | |
Under the covers, New-PSWebServer uses the HTTPListener .NET class to execute powershell code as requested, retrieves the results and sends data back through the httplistener web server framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function new-PowershellWebGUI ($HTMLRaw,$Title,$Runspace) { | |
[xml]$xaml = @" | |
<Window | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
Title="$Title" Height="500" Width="700"> | |
<Grid> | |
<DockPanel> | |
<WebBrowser Name="WebBrowser" DockPanel.Dock="Top" Margin="30"> | |
</WebBrowser> |